[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Applying text nodes: 2 processors, 2 behaviours
Subject: Re: [xsl] Applying text nodes: 2 processors, 2 behaviours From: David N Bertoni/Cambridge/IBM <david_n_bertoni@xxxxxxxxxx> Date: Mon, 18 Nov 2002 09:01:58 -0800 |
sguazt@xxxxxxxxxxx wrote: > Hi, > I have a named template that calls the <xsl:apply-templates> > instruction on its argument; however I have problem when I > pass a text as argument. More precisely with Sablot XSLT processor > I obtain the result I expect (and that I would it be!!) whereas > with LibXSLT processor I do not get what I want. OK, but what are the results of the two processors? You didn't tell us either what they were, or what you want. > In the absence of a select attribute, the xsl:apply-templates > instruction processes all of the children of the current node, > including text nodes. However, text nodes that have been stripped > as specified in [3.4 Whitespace Stripping] will not be processed. > If stripping of whitespace nodes has not been enabled for an element, > then all whitespace in the content of the element will be processed > as text, and thus whitespace between child elements will count in > determining the position of a child element as returned by the > position function. I'm not sure how this quote is relevant. All of the xsl:apply-template instructions in your sample have select attributes, and there are no xsl:strip-space or xsl:preserve-space instructions. In this template, the with-param instructions "title" and "body" create result tree fragments: > <xsl:template match="root"> > <html> > <body> > <xsl:call-template name="msg"> > <xsl:with-param name="title">A Title</xsl:with-param> > <xsl:with-param name="body">Body: <xsl:value-of > select="node" /></xsl:with-param> > </xsl:call-template> > </body> > </html> > </xsl:template> In this template, you attempt to use each these params as a node-set, which is illegal: > <xsl:template name="msg"> > <xsl:param name="title" /> > <xsl:param name="body" /> > > <p><strong><xsl:apply-templates select="$title" /></strong></p> > <p><em><xsl:apply-templates select="$body" /></em></p> > </xsl:template> Running on Xalan-C++ 1.4, I get: C:\test\Guazzone>Xalan test1.xml test1.xsl XSLT error: xsl:for-each 'select' must evaluate to a node-set, source tree node: root (file:///V:/test/Guazzone/test1.xsl, line 26, column 59) So, if LibXSLT is reporting a similar error, then its behavior is correct. If Sablotron allows this stylesheet, then it is either in error, or is implementing the old XSLT 1.1 draft recommendation. I suspect it's just a bug. If you really need to turn a result tree fragment into a node-set, you should either use the EXSLT node-set function, or your processor's proprietary one. Dave XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Applying text nodes: 2 pr, David Carlisle | Thread | Re: [xsl] Applying text nodes: 2 pr, Joerg Heinicke |
RE: [xsl] variable declaration, Stuart Brown | Date | [xsl] looping through Elements stor, Laura Jenkins |
Month |
Keywords