473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

XSLT Extension function problem?

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
Jun 27 '08 #1
4 1667
* 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>.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · 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/
Jun 27 '08 #2
On 22 Apr, 11:40, Bjoern Hoehrmann <bjo...@hoehrmann.dewrote:
* 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>.
--
Björn Höhrmann · mailto:bjo...@hoehrmann.de ·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 == ""
Jun 27 '08 #3
* 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 <testvalueat 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 · mailto:bj****@hoehrmann.de · 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/
Jun 27 '08 #4
On 22 Apr, 12:24, Bjoern Hoehrmann <bjo...@hoehrmann.dewrote:
* 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 <testvalueat 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 · mailto:bjo...@hoehrmann.de ·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!
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gordan | last post by:
I'm running Apache/1.3.33 (Win32) PHP/5.0.4 on WinXP in my php.ini I uncommented the extension=php_xsl.dll line. When running phpinfo() I have the following section on XSL xsl XSL enabled...
5
by: Don Garrett | last post by:
I have an XML document at the root of a directory tree that contains relative URIs to resources in a directory tree. During XSLT processing, these URI's can be used without any problems to...
3
by: Justine Hlista | last post by:
I'm using xalan-j_2_6_0 and trying to get an example from Michael Kay's book to work: <xsl:template match="/"> <xsl:variable name="rainbow"> <color>red</color> <color>blue</color>...
2
by: titusjava | last post by:
I am having a XSLT which transforms an input XML to transformed XML. I want to get the count of some nodes in the transformed XML, in the same XSLT. Is it do able?. Is it possible to read Output...
7
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet...
1
by: Peran | last post by:
If I create a simple xslt stylesheet I can quickly test this in VS2005 by pressing the "Show XSLT Output" button rather than running the whole solution. If I then create a xslt stylesheet with...
3
by: thomas.porschberg | last post by:
Hi, I want to read records from a database and export it in an arbitrary format. My idea was to feed a class with a String array fetched from the database and let this class fire SAX events as...
3
by: Carles Company Soler | last post by:
Hello, I want to calculate the value of an attribute. For example <rect x="2+3" y="12"and be <rect x="5" y="12">. Is it possible using XSLT? Thanks!
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
11
by: Ebenezer | last post by:
Let's suppose I have some nodes in an XML file, with an URL attribute: <node url="mypage.php?name1=value1&foo=bar&foo2=bar2&name2=value0" /> <node...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.