[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

two-phase transformation fails to match with expected

Subject: two-phase transformation fails to match with expected template.
From: Jeroen Hellingman <jeroen@xxxxxxxx>
Date: Tue, 24 Nov 2009 22:43:41 +0100
 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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.