473,883 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic parameter names in xsl

Hi!

I have an application that generates an html-form from an xml-file
using an xsl-file. My problem is that I want the xsl to use some
"unknown" parameters that I pass to the xslt processor before
processing the xml. The parameters are not totally unknown but they are
not static, they are built by an attribute in the xml and a constant
name.

Is it possible to define a "runtime" parameter and use the value passed
to the xslt processor?

xsl example:
.... begin code ...
<!-- BUILD PARAMETER NAME -->
<xsl:variable name="param_nam e"><xsl:valu e-of
select="@name"/>_T</xsl:variable>
<!-- DEFINE PARAMETER -->
<xsl:param name="$param_na me"/>
<!-- USE PARAMETER -->
<xsl:if test="$param_na me = 'some_value'">d o something</xsl:if>
.... end code ...

Any other solution to this problem is appreciated

Thanx!
/Andreas

Sep 8 '05 #1
2 4630
Tempore 18:11:56, die Thursday 08 September 2005 AD, hinc in foro {comp.text.xml} scripsit <sy************ **@gmail.com>:
Is it possible to define a "runtime" parameter and use the value passed
to the xslt processor?


No, you'll have to redesign your xslt.
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Deserta faciunt et innovationem appelant
Sep 8 '05 #2
Use a single xsl:param, whose value is a node-set that combines many
name-value pairs. Then you can use this "aggregate parameter" (or
"environmen t") like this:

<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:myParam=" my:myParam"
exclude-result-prefixes="xsl myParam">

<xsl:output omit-xml-declaration="ye s"/>

<myParam:para m>
<param name="param1">
<value>xxx1</value>
</param>
<param name="param2">
<value>xxx2</value>
</param>
<param name="param3">
<value>xxx3</value>
</param>
</myParam:param>

<xsl:param name="pallParam s"
select="documen t('')/*/myParam:*[1]/*"/>

<xsl:template match="/">
<xsl:value-of select=
"$pallParam s[@name='param2']/value"/>
</xsl:template>
</xsl:stylesheet>
Cheers,
Dimitre Novatchev


<sy************ **@gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi!

I have an application that generates an html-form from an xml-file
using an xsl-file. My problem is that I want the xsl to use some
"unknown" parameters that I pass to the xslt processor before
processing the xml. The parameters are not totally unknown but they are
not static, they are built by an attribute in the xml and a constant
name.

Is it possible to define a "runtime" parameter and use the value passed
to the xslt processor?

xsl example:
... begin code ...
<!-- BUILD PARAMETER NAME -->
<xsl:variable name="param_nam e"><xsl:valu e-of
select="@name"/>_T</xsl:variable>
<!-- DEFINE PARAMETER -->
<xsl:param name="$param_na me"/>
<!-- USE PARAMETER -->
<xsl:if test="$param_na me = 'some_value'">d o something</xsl:if>
... end code ...

Any other solution to this problem is appreciated

Thanx!
/Andreas

Sep 8 '05 #3

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

Similar topics

0
1570
by: Shailesh | last post by:
If I'm not mistaken, C++ doesn't have support for dynamic class members. I'm considering if such a facility would be useful, and what method would make a good workaround. I have a generic buffer class, which can have one or more cursor classes attached to it. Right now, they are both separate classes, and I use them as follows: class Buffer { ...
3
3720
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what a spreadsheet might show, the column names will actually be dynamic, based on data from a SQL Server 2000 database. The row data will also come from the same database. So in this case, I will have a main report and a subreport. I've already tried...
1
17692
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
3
1312
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example below... --
4
4649
by: Andrew | last post by:
Hey all, Been working with the Crystal Report Viewer, and have run into a situation I am hoping someone can help me get past. This may be more of a CR question, but hoping for some CR gurus to stop by in here. Crystal's knowledgebase has made available a bunch of examples for both ASP.Net and VB.Net applications for download and review (I added the links at the end of this post). One of the examples is how to pass in a parameter to...
4
2024
by: =?Utf-8?B?SGF5U2VlZA==?= | last post by:
Is there some way to use Generics in dynamic code using the Type.GetType("MyClassName") as an argument? List<Type.GetType("MyClassName") oList = new List<Type.GetType("MyClassName") > .... or is there a way to declare a generic using strings that hold class
26
2828
by: Aaron \Castironpi\ Brady | last post by:
Hello all, To me, this is a somewhat unintuitive behavior. I want to discuss the parts of it I don't understand. .... f= lambda: n .... 9 9
6
7982
by: =?ISO-8859-1?Q?Tim_B=FCthe?= | last post by:
Hi, we are building a Java webapplication using JSF, running on websphere, querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and PreparedStatements only (aka dynamic SQL). Every night, there is a ETL which deletes most of the data in the database and fills it all new. We observed very bad performance for some statements that ran for minutes (The queried table is about 100,000 records and the result is about 500 rows)....
1
9699
by: Sundhas | last post by:
Hey! I am working on jrxml to create dynamic re0ports. I have parameterized the columns i.e. the jrxml for that report can be used to generate other reports as well. However, i have not managed to make the fields flexible. That is, if the user selects 4 columns it would work but if 1 or 2 or 3 columns are selected, it gives an error since the field names are unidentified. Please post a solution urgently if something like a default...
0
9953
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
11166
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10868
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10422
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3242
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.