473,770 Members | 4,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic matching

Hello

I'd like to match a dynamic node, given as a parameter to the
stylesheet. Something like:

<xsl:styleshe et ...>
<xsl:param name="tomatch"/>
<xsl:template match="{$tomatc h}">
Hallo
</xsl:template>
</xsl:stylesheet>

However, this seems not to be so simple, as "{" and if I remove the
parentesis the "$" are not allowed in the match value.

Certainly, I could take this as a row xslt and pre-transform it with
another script to merge the value of the variable into the {$tomatch}
location. However, then I would need two steps, one to create the
merged xslt, and another to transform the xml with it.

Is there a way to get it simlier? Any idea how to match dynamic nodes
given in parameters would be highly appreciated.

Thanks in advance.
Daniel Frey

Jul 20 '06 #1
5 1319
Search for FXSL

Cheers,
Dimitre Novatchev

"Daniel Frey" <qw*******@gmx. chwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hello

I'd like to match a dynamic node, given as a parameter to the
stylesheet. Something like:

<xsl:styleshe et ...>
<xsl:param name="tomatch"/>
<xsl:template match="{$tomatc h}">
Hallo
</xsl:template>
</xsl:stylesheet>

However, this seems not to be so simple, as "{" and if I remove the
parentesis the "$" are not allowed in the match value.

Certainly, I could take this as a row xslt and pre-transform it with
another script to merge the value of the variable into the {$tomatch}
location. However, then I would need two steps, one to create the
merged xslt, and another to transform the xml with it.

Is there a way to get it simlier? Any idea how to match dynamic nodes
given in parameters would be highly appreciated.

Thanks in advance.
Daniel Frey

Jul 21 '06 #2
This is related to the thread "expand parts of an xml, which is
transformed by xslt to html". Either use the EXSLT
dynamic-XPath-evaluation extensions (if available), or figure out a way
to express your selection request in a form that lets you write an
interpreter in XSLT to evaluate it.

EXSLT is supported by many XSLT processors these days... but not all.
Depending on what you're trying to do, that possible loss of portability
may or may not be a problem.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jul 21 '06 #3
Thanks Joe for the hint. I looked at EXSLT and tried node-set(),
evaluate() and document(). But still, the parser does complain about
"$" in the match value. I read in Michael Kays XSLT 2nd Edition that
any sort of variable is disalowed in the match attribute to prevent
circular definitions. So it seem that there is no way to use the match
attribute.

Maybe there is another way to achive the same result. I'd like to use a
template to handle dynamic structures as described in my first post. Is
there another way to handle dynamic matches?

Daniel

Joe Kesselman schrieb:
This is related to the thread "expand parts of an xml, which is
transformed by xslt to html". Either use the EXSLT
dynamic-XPath-evaluation extensions (if available), or figure out a way
to express your selection request in a form that lets you write an
interpreter in XSLT to evaluate it.

EXSLT is supported by many XSLT processors these days... but not all.
Depending on what you're trying to do, that possible loss of portability
may or may not be a problem.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jul 21 '06 #4
Thanks for the hint Dimitre. How would FXSL help me doing that?

Daniel

Dimitre Novatchev schrieb:
Search for FXSL

Cheers,
Dimitre Novatchev

"Daniel Frey" <qw*******@gmx. chwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hello

I'd like to match a dynamic node, given as a parameter to the
stylesheet. Something like:

<xsl:styleshe et ...>
<xsl:param name="tomatch"/>
<xsl:template match="{$tomatc h}">
Hallo
</xsl:template>
</xsl:stylesheet>

However, this seems not to be so simple, as "{" and if I remove the
parentesis the "$" are not allowed in the match value.

Certainly, I could take this as a row xslt and pre-transform it with
another script to merge the value of the variable into the {$tomatch}
location. However, then I would need two steps, one to create the
merged xslt, and another to transform the xml with it.

Is there a way to get it simlier? Any idea how to match dynamic nodes
given in parameters would be highly appreciated.

Thanks in advance.
Daniel Frey
Jul 21 '06 #5
Hi Daniel,

I was mislead by the wording: "match a dynamic node, given as a parameter ",
which sounds as a good description what a higher-order xsl:function does --
with the exception that we should say "apply-templates to a dynamic node,
given as a parameter ".

Reading your post for a second time I understand what you want. One way to
achieve this is, supposing that the $tomatch parameter is defined as a
single node, is to have the following template:

<xsl:template match="node() | @*">

<xsl:choose>
<xsl:when test="generate-id() = generate-id($tomatch)">
Hallo
</xsl:when>
<xsl:otherwis e>
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
You have to assure this template has the highest import-precedence and that
any other templates are part of stylesheets imported by the stylesheet that
contains the above template. Not very convenient, but possible to do.

In XSLT 2.0 one can use the <xsl:next-matchinstructio n -- designed to
eliminate the inconvenience of using <xsl:apply-importsin a case like
this -- the overridden templates that are invoked can now be in the same
stylesheet.

Hope this helped.
Cheers,
Dimitre Novatchev
"Daniel Frey" <qw*******@gmx. chwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Thanks for the hint Dimitre. How would FXSL help me doing that?

Daniel

Dimitre Novatchev schrieb:
>Search for FXSL

Cheers,
Dimitre Novatchev

"Daniel Frey" <qw*******@gmx. chwrote in message
news:11******* *************** @p79g2000cwp.go oglegroups.com. ..
Hello

I'd like to match a dynamic node, given as a parameter to the
stylesheet. Something like:

<xsl:styleshe et ...>
<xsl:param name="tomatch"/>
<xsl:template match="{$tomatc h}">
Hallo
</xsl:template>
</xsl:stylesheet>

However, this seems not to be so simple, as "{" and if I remove the
parentesis the "$" are not allowed in the match value.

Certainly, I could take this as a row xslt and pre-transform it with
another script to merge the value of the variable into the {$tomatch}
location. However, then I would need two steps, one to create the
merged xslt, and another to transform the xml with it.

Is there a way to get it simlier? Any idea how to match dynamic nodes
given in parameters would be highly appreciated.

Thanks in advance.
Daniel Frey

Jul 21 '06 #6

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

Similar topics

1
17673
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
0
427
by: CSDunn | last post by:
Hello, I have a format issue on an Access 2000 ADP report that I am going to attempt to explain from a 'ten thousand foot view' : I have an Access 2000 ADP report that has a SQL Server 2000 Stored Procedure as its record source. The Proc is called MM_rptTeacherGroupingTest_sp. In order to help communicate the issue I am having with the report, please take a look at the following: http://www.valverde.edu/home/policy/ReportLayout.htm .
9
4493
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the "Let Users Add Functionality to Your .NET Applications with Macros and Plug-Ins" article at MSDN for the dynamic loading of DLLs http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx
1
4836
by: russ | last post by:
Hi all, Here's a problem I'm having with a dynamic table. Following the guidelines here (http://www.codeproject.com/aspnet/dynamiccontrols.asp), which make perfect sense. The problem is that the table contains a SELECT box populated on the initial load. Every time I postback I'm inserting a column into the table, the dropdown always remains in the last column. First time I postback the dropdown is populated okay. The second time...
11
3054
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
23
7416
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
2
5014
by: jmgopi | last post by:
Hi: Can somebody provide me samples on how to create a dynamic CollapsiblePanel using ASP.NET AJAX Toolkit. Any points are highly appreciated. Thanks, GJM
13
1696
by: Jess | last post by:
Hello, I have some questions to do with dynamic binding. The example program is: #include<iostream> using namespace std; class A{
4
5466
by: Bongard | last post by:
I have a dynamic range that I would like to use as a linked table into Access. The problem is that Access doesn't seem to want to to recognize the dynamic range when you click on "show named ranges" in the Link Spreadsheet wizard. The reason I want to use a dynamic range is because when the data in my excel spreadsheet changes the linked table will import blank rows that were previously used from the bottom of the spreadsheet. I can't...
0
9602
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
10237
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
10071
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
10017
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
9882
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
8905
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...
0
6690
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();...
1
3987
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
2832
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.