|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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>
</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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








