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

Re: Reusing Variables!!

Subject: Re: Reusing Variables!!
From: "George Cristian Bina" <george@xxxxxxx>
Date: Fri, 9 Jan 2004 12:40:32 +0200
conflicting variable bindings
Something like below:

<xsl:variable name="url">
    <xsl:value-of select="./breakdown[@sort='page']/@data"/>
    <xsl:text>1</xsl:text>
    <xsl:for-each select="./breakdown[@sort='param' and @type='fixed']">
        <xsl:value-of select="@name"/>
    </xsl:for-each>
</xsl:variable>

You put the logic inside the xsl:variable and just emit as output whatever
you want the variable to contain.

Now the result from your sample looks like:

index.php1entityaction

but I guess you want to obtain:

index.php?entity=User&action=View

Best Regards,
 George
-------------------------------------------------------------
George Cristian Bina mailto:george@xxxxxxxxxxxxx
<oXygen/> XML Editor - http://www.oxygenxml.com/


----- Original Message -----
From: "Robert A. van Ginkel" <robert@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, January 09, 2004 12:03 PM
Subject:  Reusing Variables!!


> [XML]
>        <action idx="1" flag="browse">
>          <breakdown sort="page" data="index.php" />
>          <breakdown sort="param" name="entity" type="fixed" data="User" />
>          <breakdown sort="param" name="action" type="fixed" data="View" />
>        </action>
> [XSL]
> <xsl:for-each select="/sg/contents/menu/actions/action">
>   <xsl:variable name="url" select="./breakdown[@sort='page']/@data"/>
>   <xsl:variable name="url" select="concat($url,'1','')"/>
>   <xsl:for-each select="./breakdown[@sort='param' and @type='fixed']">
>     <xsl:variable name="url" select="concat($url,@name,'')"/>
>   </xsl:for-each>
> </xsl:for-each>
>
> Would give:
> Sablotron error on line 136: conflicting variable bindings 'url'
> (line number is wrong)
> I looked this up and  "Parameters are normal variables according to the
> XSLT 1.0 spec. Thus, you can't use two variables of the same name in a
> template. Libxslt and Xalan are too forgiving here. Saxon would give you
> the same error as Sablotron. Saxon is the right authority for the spec
> interpretation issues, I believe."
> This explains it, but how can I get what I want here?
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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