This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: how to setStyleSheetParam() passing a url
- To: <xsl-list at mulberrytech dot com>
- Subject: Re: how to setStyleSheetParam() passing a url
- From: "Steve Muench" <smuench at us dot oracle dot com>
- Date: Sun, 19 Mar 2000 14:48:56 -0800
- References: <38D55031.2A973DEC@home.com>
- Reply-To: xsl-list at mulberrytech dot com
| 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>
</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