XSLT Extension function problem?

H

harryajh

Using xalan 2.7.1

I'm using XSLT extension functions to retrieve special bits of code
from a java class static methoth during transformation.

What I'd like to know is if there is anyway to specify a param passed
in to the stylesheet as an argument in the extension function?

I currently something like this -

<xsl:value-of select="ext:getXSLTCode('part1', 'true')"/>

but what I'd like to do is something like this -

<xsl:param name="partNo"/>

<xsl:value-of select="ext:getXSLTCode($partNo, 'true')"/>

Obvioulsy this doesn't work & nor does having a nested value-of - has
anyone any idea if this is actually possible? if not any workarounds?

thanks in advance

harry
 
B

Bjoern Hoehrmann

* harryajh wrote in comp.text.xml:
What I'd like to know is if there is anyway to specify a param passed
in to the stylesheet as an argument in the extension function?

I currently something like this -

<xsl:value-of select="ext:getXSLTCode('part1', 'true')"/>

but what I'd like to do is something like this -

<xsl:param name="partNo"/>

<xsl:value-of select="ext:getXSLTCode($partNo, 'true')"/>

Obvioulsy this doesn't work & nor does having a nested value-of - has
anyone any idea if this is actually possible? if not any workarounds?

I am not sure what is obvious about this; perhaps you did not set the
parameter to a specific value? Does it work if you use string($partNo)
instead? Do you get some error message? You can find the documentation
at <http://xml.apache.org/xalan-j/extensions.html#ext-functions>.
 
H

harryajh

* harryajh wrote in comp.text.xml:








I am not sure what is obvious about this; perhaps you did not set the
parameter to a specific value? Does it work if you use string($partNo)
instead? Do you get some error message? You can find the documentation
at <http://xml.apache.org/xalan-j/extensions.html#ext-functions>.

Thankyou Björn for such a quick reply, I've tried both those methods
and although no error is given the parameter is passedd empty!

i.e

<xsl:variable name="partNo" select="testvalue"/>
<xsl:value-of select="ext:getXSLTCode(string($partNo), $partNo)"/>

in my Java code

public static String getXSLTCode(String key, String internalOnly)
...

both key & internalOnly == ""
 
B

Bjoern Hoehrmann

* harryajh wrote in comp.text.xml:
Thankyou Björn for such a quick reply, I've tried both those methods
and although no error is given the parameter is passedd empty!

i.e

<xsl:variable name="partNo" select="testvalue"/>

Do you have an element <testvalue> at the right position and if yes,
what is its contents? If you wanted to specify a string, you have to
put it in quote marks like so:

<xsl:variable name="partNo" select=" 'testvalue' "/>

I've added spaces around the value to clarify what I mean. If you do
not quote the value, it will treat the identifer as element name.
 
H

harryajh

* harryajh wrote in comp.text.xml:


Do you have an element <testvalue> at the right position and if yes,
what is its contents? If you wanted to specify a string, you have to
put it in quote marks like so:

<xsl:variable name="partNo" select=" 'testvalue' "/>

I've added spaces around the value to clarify what I mean. If you do
not quote the value, it will treat the identifer as element name.

think I've fixed it now Björn, not really sure what the problem was,
many thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top