473,811 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT: Result trees in variables

I'm passing a result tree fragment that holds multiple strings
(fieldnames, in this case) and in the called template I wan't to test if
a certain string contains any of those names.

I have this:

<xsl:apply-templates select="field">
<xsl:with-param name="element-names">
<names>
<name>foo</name>
<name>bar</name>
</names>
</xsl:with-param>
</xsl:apply-templates>

....

<xsl:template match="field">
<xsl:param name="element-names" />

<xsl:variable name="search-element-names">
<result>
<xsl:for-each select="$elemen t-names/names/name">
<xsl:if test="contains( 'foobar', text())">.</xsl:if>
</xsl:for-each>
</result>
</xsl:variable>

<xsl:variable name="search-condition" select="$search-element-names =
''" />
I get this:

Can not convert #RTREEFRAG to a NodeList!
What is the parser trying to say to me?

Any ideas how to fix it?

Jul 20 '05 #1
1 4305
On Thu, 14 Aug 2003 16:02:31 +0300, Aleksi Kallio wrote:

I get this:

Can not convert #RTREEFRAG to a NodeList!
What is the parser trying to say to me?

Any ideas how to fix it?


Passing a fragment of XML tree to a variable you get a data
type called Result Tree Fragment, which is quite useful
to store chunks of XML tree but fails when used in an xpath expression.
To get this working you must convert rtf back to a node set by
applying the extension function node-set().
In order to use this you must first declare a proper extension namespace
in your stylesheet. Most likely your processor supports exslt:

<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:exsl="htt p://exslt.org/common"
extension-element-prefixes="exsl" >

--
Patryk Dworznik

Jul 20 '05 #2

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

Similar topics

2
2795
by: Tom Corcoran | last post by:
I am working to ease updating of a html page by transforming 2 xml files. I was going to use xslt for this and had bought 2 unopened books, wrox xslt and o'reilly's xslt cookbook. But am now wondering if I am better of learning XQuery instead? Any thought and opinions would be appreciated. Cheers - Tom. The Architect: "Hope, it is the quintessential human delusion,
5
2228
by: Ruthless | last post by:
hello. All XML and XSLT are processed by preprocessor as a trees. How can i simply display my XML as some kind of tree. given xml: <struct> <node level="1" no="1">
3
2430
by: Kevin Brown | last post by:
Is there anyway to generate this type of resulting HTML table from this XML using XSLT? Basically I need to be able to consult 2 trees of data to generate the HTML, but I have not been able to figure out how to do so. There is supposed to be a way of using templates and the key function to do grouping, but can it be done with 2 different trees? If so, are there any examples of such things Thanks for any help, Kevin
1
564
by: Oleg Konovalov | last post by:
Hi, I am new to XSLT, trying to significantly modify somebody else's XSL. That is not 2.0. I need to create min & max variable(s) to be used in many templates and sub-templates based on certain conditions (not always). It can't be calculated at the beginning of the file
2
2272
by: trash.muell | last post by:
Hi, I am struggling with an XSLT task and need a hint: I have a complex XML file but want to only output some sub-trees of the XML structure. My XSLT script is always printing the information of the whole XML file. Only if I explicitely exclude subtrees/nodes with <xsl:template match="anExcludedNode" /> their content doesn't appear in the output. Is this the only way to do
3
3870
by: binary_sunset | last post by:
Okay... so this may be all to obvious to all except myself, but I am having some difficulty with XML output from Adobe InDesign. Each separate article in my publication is tagged as an article, with a component tree, but the articles all appear in the XML output as child nodes of the previous article ala: <article> <title/> <date/> <body/>
4
1797
by: Grant Robertson | last post by:
Can an XML Stylesheet Language Transform take data that is spread out in multiple different XML files and not necessarily in proper order, rearrange that data into it's proper order and then compile all of that into a series HTML web pages for presentation? Or would I need to write a custom program for that kind of thing? Thanks
2
22781
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 in the attribute of an element. Instead of using the <xsl:attribute> element, you can simply place the xpath in the attribute itself. The most common usage of this is in creating hyperlinks.
11
2096
by: =?ISO-8859-1?Q?Jean=2DFran=E7ois_Michaud?= | last post by:
Context: I'm trying to compare XML tree fragments and I'm doing so by outputting the attributes of each element in the tree and outputting it to a string then normalizing the strings. Then I'm doing a contains of the current string against the following-sibling::* to determine if we have duplicates. If we have a duplicate, we move to the next item, if there is no duplicate, we output the small tree. I'm hitting a completely ridiculous...
0
9734
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
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10656
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...
1
10410
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
10138
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...
1
7674
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
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3878
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3027
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.