Subject: RE: [xsl] two-phase transformation fails to match with expected template. From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 24 Nov 2009 22:00:55 -0000 |
You created the navPoint element in the namespace http://www.w3.org/1999/xhtml (which seems a bad idea, but if you do it, then you need to match it in that namespace). Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Jeroen Hellingman [mailto:jeroen@xxxxxxxx] > Sent: 24 November 2009 21:44 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] two-phase transformation fails to match with > expected template. > > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] two-phase transformation fail, Jeroen Hellingman | Thread | Re: [xsl] two-phase transformation , Jeroen Hellingman |
[xsl] two-phase transformation fail, Jeroen Hellingman | Date | Re: [xsl] two-phase transformation , Jeroen Hellingman |
Month |