[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Need help with apply-templates to set variables


Subject: Re: [xsl] Need help with apply-templates to set variables
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Sun, 03 Feb 2002 20:13:18 +0000

Brad,

Think trees not text.

><xsl:value-of select="task:addPage($task, @ident, $body)" />
></xsl:template>
>
>When $body is received (as a String) by my addPage routine, it 
>contains only text with all markup removed. For example, for 
>this input
>
If the third argument to addPage is declared as a String, and you pass
it a result tree fragment, then the XSLT processor will do an implicit
conversion using the XPath string() function.  This returns just the
text nodes, i.e. no markup.

You probably need to change the signature (and internal logic) of
addPage to handle DOM nodes instead of strings - without knowing what
the structure of the overall application is, it is hard to give
detailed advice.

>It seems that markup is deleted only when the results are saved 
>in a variable. If I add a <xsl:apply-templates select="*"/> 
>outside of the variable assignment in the above, the output 
>contains markup as expected.
>
I'm not sure what you are seeing here - but I think you are being
misled.
Try <xsl:copy-of select="$body" /> and you will see "markup" in the
output: this should convince you that its nothing to do with the
variable, the information is being lost in the call to Java, for the
reason I gave above.

Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

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



Current Thread
Keywords