473,657 Members | 2,800 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 4623
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
1561
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
3705
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
17657
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
4641
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
2014
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
2799
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
7964
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
9660
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
8737
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
8509
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
8610
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
7345
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6174
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
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
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.