Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT Extension function problem?

Reply
Thread Tools

XSLT Extension function problem?

 
 
harryajh
Guest
Posts: n/a
 
      04-22-2008
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 -

<xslaram 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
 
Reply With Quote
 
 
 
 
Bjoern Hoehrmann
Guest
Posts: n/a
 
      04-22-2008
* 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 -
>
> <xslaram 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>.
--
Björn Höhrmann · (E-Mail Removed) · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
 
Reply With Quote
 
 
 
 
harryajh
Guest
Posts: n/a
 
      04-22-2008
On 22 Apr, 11:40, Bjoern Hoehrmann <(E-Mail Removed)> wrote:
> * 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 -

>
> > <xslaram 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>.
> --
> Björn Höhrmann · (E-Mail Removed) ·http://bjoern.hoehrmann.de
> Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·http://www.bjoernsworld.de
> 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·http://www.websitedev.de/


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 == ""


 
Reply With Quote
 
Bjoern Hoehrmann
Guest
Posts: n/a
 
      04-22-2008
* 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.
--
Björn Höhrmann · (E-Mail Removed) · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
 
Reply With Quote
 
harryajh
Guest
Posts: n/a
 
      04-22-2008
On 22 Apr, 12:24, Bjoern Hoehrmann <(E-Mail Removed)> wrote:
> * 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.
> --
> Björn Höhrmann · (E-Mail Removed) ·http://bjoern.hoehrmann.de
> Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·http://www.bjoernsworld.de
> 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·http://www.websitedev.de/


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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including XSLT/XML document within a XSLT document dar_imiro@hotmail.com XML 4 12-13-2005 02:26 AM
Multiple XSLT Transforms using a Controller XSLT sneill@mxlogic.com XML 2 10-19-2005 11:00 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
xslt alone or xslt/java for static site? ted XML 1 01-26-2004 10:41 AM
[XSLT]Passing values from Javascript to a XSLT variable Benjamin Hillsley XML 3 09-25-2003 04:50 AM



Advertisments