RE: [xsl] Applying text nodes: 2 processors, 2 behaviours

Subject: RE: [xsl] Applying text nodes: 2 processors, 2 behaviours
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 19 Nov 2002 09:17:20 -0000
You are not passing "text" as an argument, you are passing a result tree
fragment. Calling xsl:apply-templates on a result tree fragment is
disallowed by the XSLT 1.0 specification, but because it was permitted
by the XSLT 1.1 working drafts and now the XSLT 2.0 working drafts, some
processors allow it.

With a processor that doesn't allow it, you need to use the
xx:node-set() extension to turn the result tree fragment into a
node-set.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> sguazt@xxxxxxxxxxx
> Sent: 18 November 2002 16:54
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Applying text nodes: 2 processors, 2 behaviours
> 
> 
> 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. Reading the W3C XSLT spec I found: ... 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. ...
> 
> So it's seem that LibXSLT fails!!
> For clarity I give you a simple example:
> XML:
> --------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <root>
>         <node>foobar</node>
> </root>
> --------------------------
> XSL:
> --------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <xsl:stylesheet version="1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> >
> 
> <xsl:output method="html" encoding="ISO-8859-1" 
> media-type="text/html" indent="yes" />
> 
> <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>
> 
> <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>
> 
> </xsl:stylesheet>
> --------------------------
> 
> So Am I confused or ....?!?!
> Thank you in advance!!!!!
> 
> -- 
> --------------------------------
> Marco Guazzone
> Software Engineer
> Kerbero S.r.L. - Gruppo TC
> Viale Forlanini, 36
> Garbagnate M.se (MI)
> 20024 - Italy
> mail: marco.guazzone@xxxxxxxxxxx
> www: http://www.kerbero.com
> Tel. +39 02 99514.247
> Fax. +39 02 99514.399
> --------------------------------
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread