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

creating an element at runtime to pass into a template

I'm creating an element at run time with the following code

<xsl:variable name="myElement">
<xsl:element name="abc">
<xsl:value-of select="." />
</xsl:element>
</xsl:variable>

<xsl:call-template name="myTemplate">
<xsl:with-param select="$myElement">
</xsl:call-template>

But XML Spy gives me a "Error in XPath expression, Cannot use result
tree fragment"
I can do a <xsl:value-of select="$myElement" /> but I can't pass the
newly created element as a parameter.

Does anyone know of a solution?
Jul 20 '05 #1
1 1550


Biff Malone wrote:
I'm creating an element at run time with the following code

<xsl:variable name="myElement">
<xsl:element name="abc">
<xsl:value-of select="." />
</xsl:element>
</xsl:variable>

<xsl:call-template name="myTemplate">
<xsl:with-param select="$myElement">
</xsl:call-template>

But XML Spy gives me a "Error in XPath expression, Cannot use result
tree fragment"
I can do a <xsl:value-of select="$myElement" /> but I can't pass the
newly created element as a parameter.

Does anyone know of a solution?


This is a known restriction in XSLT 1.0, however many XSLT processors
provide an extension function to convert a result tree fragment to a
node set, see
http://www.exslt.org/exsl/functions/node-set/index.html
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

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

Similar topics

6
by: gonzalo briceno | last post by:
I have been using phplib for a while and I really like the framework except for form creation. Maybe it is me but I in my opinion there isn't a good way to create forms or should I say, everything...
13
by: Noah Spitzer-Williams | last post by:
Hello guys, I would like to do something seemingly simple: find out if an element in an array that is passed to my function exists. I used to think I could just do: if (arr) ... However, if...
4
by: Pat Turner | last post by:
Hi, I have some XML like this: <family> <person name="bob"> <father ref="../../person" /> </person> <person name="charlie"> <child ref="../../person" />
8
by: lok | last post by:
i have a class: template <class T1, class T2> class CPairMapping { public: typedef std::pair<T1, T2> ValuePair_t; typedef std::vector<ValuePair_t> ValueList_t; typedef std::binary_function<...
3
by: sp | last post by:
the xml file i used <catalog> <cd> <title year="1990">Empire Burlesque</title> <artist>Bob Dylan</artist> <price>10.90</price> </cd> <cd>
15
by: CI | last post by:
I have the following XML file <Book> <Chapters> <Chapter number="1"/> <Chapter number="2"/> </Chapters> <Colors> <Color RGB="255"/> <Color RGB="211" name="Red"/>
8
by: jesmi | last post by:
my code is: addRecord.cfm <cfinclude template="head.cfm"> <p> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td> <div align="center">
13
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I am not accustomed to creating xml files programmatically. The big picture is this: This will be in VB/VS 2005/ winforms. I have a DTD, a sample XML, and an outside data source I will use to...
5
by: randysimes | last post by:
I am making a previous program into a template to calculate all 11 options. (int, double, long double, char, etc) I believe I have the right idea, but the syntax is way off. Could you please provide...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...
0
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,...

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.