[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How do I build a nodeset "programmatically" for p
I was about to post something about this, just when Wendell's reply came up. He has explained the concept very nicely. To add to his answer, I could give you some syntax (which is self-explainatory): <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:common="http://exslt.org/common"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <xsl:variable name="speed_table_values"> <entry> <radius>30</radius> <speed_km_h>60.9</speed_km_h> <speed_mph>50.1</speed_mph> </entry> <entry> <radius>60</radius> <speed_km_h>72.9</speed_km_h> <speed_mph>60.1</speed_mph> </entry> <entry> <radius>61</radius> <speed_km_h>81.9</speed_km_h> <speed_mph>70.4</speed_mph> </entry> <entry> <radius>100</radius> <speed_km_h>99.9</speed_km_h> <speed_mph>75.1</speed_mph> </entry> </xsl:variable> <xsl:call-template name="X"> <xsl:with-param name="param_x" select="$speed_table_values" /> </xsl:call-template> </xsl:template> <xsl:template name="X"> <xsl:param name="param_x" /> <xsl:for-each select="common:node-set($param_x)/entry"> <xsl:value-of select="radius" /> </xsl:for-each> </xsl:template> </xsl:stylesheet> But instead, if you try to do following with an XSLT 1.0 processor: <xsl:for-each select="$param_x/entry"> <xsl:value-of select="radius" /> </xsl:for-each> You will get an error. Because as Wendell said, an RTF may only be copied to the result tree or converted to a string. Here parameter param_x holds an RTF. As Wendell said, XSLT 1.1 is not popular, and also not well supported, so why not base your stylesheet on XSLT 1.0? Or, XSLT 2.0 if you like. On 8/17/06, Zaleski, Matthew (M.E.) <mzaleski@xxxxxxxx> wrote: I'm using Saxon 6.5.x (and XSL 1.1).
http://gandhimukul.tripod.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|