ray_hayes
asked on
How to count missing textual references using XSL
If I have an XML document as follows:
<info>
<books>
<book name="Book1" />
<book name="Book2" />
<book name="Book3" />
<book name="Book4" />
<book name="Book5" />
<book name="Book6" />
</books>
<quotes>
<quote from="Book1" />
<quote from="Book13" />
<quote from="Book4 />
<quote from="Book2" />
</quotes>
</info>
How can I get a count of the //quotes/quote items where there is no corresponding //books/book (using the @from as a pivot against the @name)?
I'm sure it's something to do with xsl:key but can't get anything to work. The source-data is hand-coded and a schema will not suffice... it's not illegal (in my real-world case) for the data to be missing, I simply need to know how many are missing....
Thanks.
Ray
<info>
<books>
<book name="Book1" />
<book name="Book2" />
<book name="Book3" />
<book name="Book4" />
<book name="Book5" />
<book name="Book6" />
</books>
<quotes>
<quote from="Book1" />
<quote from="Book13" />
<quote from="Book4 />
<quote from="Book2" />
</quotes>
</info>
How can I get a count of the //quotes/quote items where there is no corresponding //books/book (using the @from as a pivot against the @name)?
I'm sure it's something to do with xsl:key but can't get anything to work. The source-data is hand-coded and a schema will not suffice... it's not illegal (in my real-world case) for the data to be missing, I simply need to know how many are missing....
Thanks.
Ray
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.