Subject: RE: Re: Sort XML based on Tokenized String of sort by field
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 29 May 2008 17:17:53 +0100
|
> I tried to create a variable to hold this stylesheet but when
> I output the variable - it is empty.
>
> Like I try
>
>
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="2.0" xmlns:saxon="http://saxon.sf.net/">
>
> <xsl:variable name="PATH" select="REPORT/REPORT_FORMAT/PARENT_NODE"/>
> <xsl:variable name="ORDER_BY"
> select="REPORT/REPORT_FORMAT/ORDER_BY"/>
> <xsl:variable name="ORDER_BY_TOKEN"
> select="tokenize($ORDER_BY,'\s*,\s*')"/>
>
> <xsl:strip-space elements="*"/>
>
> <xsl:output indent="yes"/>
>
> <xsl:template match="/">
> <xsl:variable name="NEW_STYLESHEET"
> <xsl:element name="xsl:transform">
> ....
> </xsl:element>
> </xsl:variable>
That's fine so far.
> <xsl:value-of select="$NEW_STYLESHEET"/>
xsl:value-of flattens whatever you give it into a single text node: it loses
all the markup. If you want to see what's in the variable, use xsl:copy-of.
To do the transformation, you just want
<xsl:copy-of select="saxon:transform(/, $NEW_STYLESHEET)"/>
Michael Kay
http://www.saxonica.com/
|