XSLTGeneral questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
here is my XML
<books>
<book id = "1" pub-id = "" isenglish = "Yes" author = "abc1">History1</book>
<book id = "2" pub-id = "" isenglish = "Yes" author = "abc2">History2</book>
<book id = "3" pub-id = "" isenglish = "Yes" author = "abc3">History3</book>
<book id = "4" pub-id = "" isenglish = "No" author = "abc">History4</book>
<book id = "5" pub-id = "" isenglish = "Yes" author = "abc1">History5</book>
<book id = "6" pub-id = "" isenglish = "No" author = "abc2">History6</book>
<book id = "7" pub-id = "1" isenglish = "Yes" author = "abc4">History7</book>
<book id = "8" pub-id = "" isenglish = "Yes" author = "abc5">History8</book>
</books>
using following key i can choose all booknodes where isenglish attribute value is Yes.
<xsl:key name="bookByLanguage" match="book[@isenglish="Yes"]" use="id"/>
But i need to choose all book nodes where isenglish attribute value is Yes and pub-id is equal to blank.
Can anyone please help me to write this match where two conditions are checked at once.
I suspect you don't want to do that. xsl:key declares an index; the key() function uses the index to do a search. This particular declaration allows you to find an English book quickly if you know its id. But the id appears to be unique across all books, so if you know its id, you can find it without knowing whether or not it is English: using match="book" would give the same result.
I think I need to understand your requirements better.
Michael Kay http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference