[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] two-phase transformation fails to match with expected
I am trying to do a two-phase transformation in the following stylesheet
(stripped to show the issue), adding some more attributes in the second
phase, which would be fairly difficult to calculate correctly at once.
However, the template adding the attribute seems not to fire at all.
(I expect my navPoint elements to get an additional playorder attribute.) (Using Saxon HE 9) Am I overlooking something? Would the xsl:number work in the context of the variable, or of the input document? <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" method="xml" encoding="UTF-8"/> <xsl:template match="/"> <xsl:variable name="test"> <html> <navPoint class="section" id="xd21e491"> <navLabel> <text>Test 1</text> </navLabel> <content src="test-ch05.xhtml#xd21e491"/> </navPoint> <navPoint class="section" id="xd21e491"> <navLabel> <text>Test 2</text> </navLabel> <content src="test-ch05.xhtml#xd21e491"/> </navPoint> </html> </xsl:variable> <xsl:apply-templates select="$test" mode="playorder"/> </xsl:template> <xsl:template match="text" mode="playorder"/> <xsl:template match="navPoint" mode="playorder"> <xsl:copy> <xsl:attribute name="playOrder"><xsl:number level="any" count="navPoint"/></xsl:attribute> <xsl:apply-templates select="@*|node()" mode="playorder"/> </xsl:copy> </xsl:template> <xsl:template match="@*|node()" mode="playorder"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="playorder"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|