This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: how to setStyleSheetParam() passing a url


| What I really need to do is replace object_key with a dynamic object_key
| but I can figure out if it's "legal" to imbed one parameter in the value
| of another.  For example:
| 
   :
| Is this valid and if so what's the correct syntax?

Here's a couple of ways you can do this...

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

  <xsl:param name="key">12345</xsl:param> <!-- Test value -->

  <!-- Technique 1, Using <xsl:text> and <xsl:value-of> -->
  <xsl:param name="url">
    <xsl:text>http://localhost:8000/servlet/servletName?objectKey=</xsl:text>
    <xsl:value-of select="$key"/>
  </xsl:param>

  <!-- Technique 2, Use concat() function. -->
  <xsl:param name="url2"
     select="concat('http://localhost:8000/servlet/servletName',
                    '?objectKey=', $key)" />

  <xsl:template match="/">
    <xsl:value-of select="$url"/>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of select="$url2"/>
  </xsl:template>

</xsl:stylesheet>

If I try this from the command-line with Oracle XSLT,
passing a value for the parameter, I get:

$ oraxsl -p key='9988' data.xml test.xsl

http://localhost:8000/servlet/servletName?objectKey=9988
http://localhost:8000/servlet/servletName?objectKey=9988

Hope this helps.

_________________________________________________________
Steve Muench, Consulting Product Manager & XML Evangelist
Business Components for Java Development Team


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]