(Q9) List the titles of books published by Morgan Kaufmann in 1998.FOR $b IN document("bib.xml")//book WHERE $b/publisher = "Morgan Kaufmann" AND $b/year = "1998" RETURN $b/title XSLT equivalent to (Q9)<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="document('bib.xml')//book"> <xsl:if test="publisher='Morgan Kaufmann' and year='1998'"> <xsl:copy-of select="title"/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:transform> Or, bring it all up into the path expression...<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:copy-of select="document('bib.xml')//book[publisher='Morgan Kaufmann' and year='1998']/title"> </xsl:template> </xsl:transform> |
|||
|