xsl-list
[Top] [All Lists]

RE: Building Dynamic Urls

2005-05-07 01:45:37
Put the conditional inside the expression that initializes the variable:

<xsl:variable name="x">
  <xsl:value-of select="$url"/>
  <xsl:if test="child::area">?<xsl:value-of select="child::area"/></xsl:if>
  <xsl:if test="child::action">&amp;<xsl:value-of
select="child::action"/></xsl:if>
</xsl:variable>

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Adam J Knight [mailto:adam(_at_)brightidea(_dot_)com(_dot_)au] 
Sent: 07 May 2005 09:06
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Building Dynamic Urls

Hi all,

  I am wanting to build dynamic urls in xslt by using string 
concatenation,
unless there is a better way. My stylesheet will be sent a 
$url parameter to
provide the base of the url. From their my logic is as follows:
    
<xsl:if test="child::area">
  Building_url = $url and "?area=" and <xsl:value-of select="area"/>
</xsl:if>

<xsl:if test="child::action">
  Building_url = $url and "&action=" and <xsl:value-of 
select="action"/>
</xsl:if>

<xsl:if test="child::page">
  Building_url = $url and "&page=" and <xsl:value-of select="page"/>
</xsl:if>

I as I understand it, xsl variables can't be changed once 
given a value.
So what would be the best way to go about building these dynamic urls.

Help appreciated!

Cheers, 
Adam 


--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>