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

Variable - Results Tree Fragment Problem

Subject: Variable - Results Tree Fragment Problem
From: Pappa <anarkin@xxxxxxxxxxxx>
Date: Wed, 27 Aug 2003 21:58:30 +0100
cannot use result tree fragment
Hi,

I have a little problem, which I assume is connected with the values I'm after being converted to results tree fragments. I have tried various things, but nothing seems to work. Also, as I'm using Sablotron, I cannot use extensions such as node-set() to solve this problem.

I'm trying to get the values of all the parameters without referencing each one explicitly.

Here's the code. [I have replaced document("") with document("this.xsl") because of a Sablotron bug].

<?xml version='1.0' encoding='iso-8859-1'?>

<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:output method='text'/>

   <xsl:param name='p1' select='"red"'/>
   <xsl:param name='p2' select='"blue"'/>
   <xsl:param name='p3' select='"green"'/>

<xsl:template match='/'>
<!-- THIS IS THE RESULT I AM AFTER - 'red, blue, green' -->
<xsl:value-of select='$p1'/>, <xsl:value-of select='$p2'/>, <xsl:value-of select='$p3'/>
<xsl:text>
</xsl:text>
<!-- THIS WAS MY FIRST ATTEMPT AT GETTING THE VALUES OF THE PARAMETERS WITHOUT REFERENCING THEM EXPLICITLY - I GET THE RESULT ', , ' -->
<xsl:for-each select='document("this.xsl")/xsl:stylesheet/xsl:param'>
<xsl:value-of select='.'/><xsl:if test='position()!=last()'>, </xsl:if>
</xsl:for-each>
<xsl:text>
</xsl:text>
<!-- THIS WAS MY SECOND ATTEMPT. INSTEAD OF THE VALUES, I GET THE RESULTS TREE FRAGMENTS - '$p1, $p2, $p3' -->
<xsl:for-each select='document("this.xsl")/xsl:stylesheet/xsl:param'>
<xsl:variable name='params' select='concat("$p",position())'/>
<xsl:value-of select='$params'/><xsl:if test='position()!=last()'>, </xsl:if>
</xsl:for-each>
</xsl:template>


</xsl:stylesheet>

And here's the output:

red, blue, green
, ,
$p1, $p2, $p3



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



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-2007 All Rights Reserved.