473,394 Members | 2,071 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,394 software developers and data experts.

XSLT question: how to use params as strings

My XSLT stylesheet has the following top-level parmeter definition:

<xsl:param name="MethodName">&apos;Foobar&apos;</xsl:param>

Later in the stylesheet I try to base an xsl:if test on it:

<xsl:if test="normalize-space( @Method ) = normalize-space($MethodName)">

The test condition is never satisfied. Now if I substitute the value of
the parameter in:

<xsl:if test="normalize-space( @Method ) =
normalize-space(&apos;Foobar&apos;)">

The condition is satisfied. (And yes, there is a Method attribute in the
document with the value "Foobar".

Now I've tried all sorts of things like using quotes versus double quotes,
leaving the quotes out of the param definition and/or surrounding the
reference with quotes, etc.

None of it works... only using the VALUE of the parameter in place of the
$MethodName reference seems to work.

What am I not doing right?

Thanks

Jul 20 '05 #1
2 1121
"David Blickstein" <db@hp.com> writes:
My XSLT stylesheet has the following top-level parmeter definition:

<xsl:param name="MethodName">&apos;Foobar&apos;</xsl:param>


This sets $MethodName to be a result tree fragment consisting of a
document node with text ndode child the string 'Foobar' with the quotes
being part of the string value, not delimiters.

You want

<xsl:param name="MethodName">Foobar</xsl:param>

or more efficiently bind to a string rather than a result tree fragment:

<xsl:param name="MethodName" select="'Foobar'"/>

This assumes you are not passing in a value to this parameter from
outside (if you are then the default value in the stylesheet is ignored)

David
Jul 20 '05 #2
Thanks, that did it.

Apparantly Stylevision insists on putting parameters in as result trees
rather than attributes.
Jul 20 '05 #3

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

Similar topics

9
by: Hayko Riemenschneider | last post by:
Hi! I've got me an XSL tranformation stylesheet for my XML file. In the XSL file I now wish to use PHP to do some scripting. So I thought I'll use the PIs like this: ...
2
by: philips | last post by:
Hi everybody, I am using the Xalan 1.8 C++ API in a real-time financial application which need to apply XSLT transformations on XML input messages received on-the- fly. On the process output,...
3
by: googleboy | last post by:
Hi there. I have defined a class called Item with several (about 30 I think) different attributes (is that the right word in this context?). An abbreviated example of the code for this is: ...
12
by: Keith Chadwick | last post by:
I have a fairly hefty XSLT file that for the sake of debugging and clarity I wish to split into some separate sub-templates contained within the same file. The master template calls an...
3
by: z_learning_tester | last post by:
Hello, I'm studying parameter arrays now and see what looks like a contradiction in my book. First it says that to pass any number of say object types to a method you say: int myMethod (params...
21
by: Damian | last post by:
Hi, I'm from an ASP.NET background an am considering making the switch to Python. I decided to develop my next project in tandem to test the waters and everything is working well, loving the...
6
by: bcochofel | last post by:
I'm using xsl to list an xml file that contains something like: sites, tag and weight. I'm listing this in a table with the following titles: | URL | TAG | WEIGHT (each title his a link) What...
3
by: Chrism2671 | last post by:
I'm new to XSLT/XML and I have a very simple, quick question. i've been trying to convert simple xml files into CSV files and have made a simple XSLT template using the w3 tutorials, but it doesn't...
4
by: Adam Lanier | last post by:
Relatively new to python development and I have a general question regarding good class design. Say I have a couple of classes: Class Foo: params = __init__( self, param ): ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.