[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re: Sort XML based on Tokenized String of sort by

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
RE:  Re: Sort XML based on Tokenized String of sort by
> 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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.