xsl-list
[Top] [All Lists]

RE: [xsl] Re: Sort XML based on Tokenized String of sort by field

2008-05-29 09:18:30
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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>