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

RE: Problem Dynamically Building Query String In XSLT

Subject: RE: Problem Dynamically Building Query String In XSLT 1.0
From: <Trish@xxxxxxxxxxxxxx>
Date: Tue, 31 Jul 2007 13:26:12 -0400
RE:  Problem Dynamically Building Query String In XSLT
After getting two excellent and informative responses, I went with the
following (note, there is one change in the last line of the code. I
moved one of the parentheses):

<xsl:value-of select="substring($u, 1, string-length($u) - 1)"/>

This works beautifully!

Thanks for your help!
Trish

-----Original Message-----

Given the limitations of 1.0, where you can't manipulate sequences of
strings, or create and then process temporary trees, I would do:

<xsl:variable name="u">
  <xsl:text>pagename.aspx?</xsl:text>
  <xsl:if test="$varTarget">
    <xsl:text>target=</xsl:text>
    <xsl:value-of select="$varTarget">
    <xsl:text>&amp;</xsl:text>
  </xsl:if>
  <xsl:if test="$varPage">
    <xsl:text>page=</xsl:text>
    <xsl:value-of select="$varPage">
    <xsl:text>&amp;</xsl:text>
  </xsl:if>
  .. repeat for other parameters
</xsl:variable>
<xsl:value-of select="substring($u, 1, string-length($u - 1))"/>

that is, add an & after every parameter, then at the end strip off the
last
character of the string.

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

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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.