XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1169)
- Stylus Studio Technical Forum (14440)
-> - Error Message (1)
-> - jvm disabled message keeps pop... (1)
-> + XTSE0620: An xsl:param element... (3)
-> + Fail in installing ďApache FOP... (3)
-> - Jenkins: about the path of bui... (1)
-> + problem with Stylus X15 XML RE... (2)
-> + Cannot remove a row into a tab... (6)
-> + prevent the meta data from bei... (3)
-> + Unable to auto detect JRE in X... (2)
-> - Unable to auto detect JRE in X... (1)
-> - where to find information (1)
-> + X16 - XPath 3.0, XQuery 3.0, X... (2)
-> - Test (1)
-> + XSLT debugger shows [symbol u... (3)
-> - How do i use *.conv to process... (1)
-> - How do i use *.conv to process... (1)
-> + Not able to configure JVM in ... (5)
-> + Converting Cobol flat file to ... (2)
-> + Problem with uninstall - Windo... (2)
-> + Function current() is not reco... (6)
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (244)
+ XSLT Help and Discussion (7593)
+ XQuery Help and Discussion (1941)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (363)
+ Stylus Studio Announcements (113)
hungry backspaceSubject: Creating dynamically named elements
Author: hungry backspace
Date: 26 Dec 2007 02:51 PM

i've read a few posts on the subject of creating dynamically-named elements using the name() function. that technique seems to work for me, but only in limited applications. specifically, i'm finding that using it is problematic within certain templates. for example, this template is called within another template, which is in turn called by yet another template:

<xsl:template match="quote">
<xsl:for-each select="*">
<xsl:for-each select="*">

<xsl:variable name="itemName">
<xsl:value-of select="php:function('translateItems', string(name()))" />

<xsl:element name="example">
<xsl:value-of select="$itemName" />

<xsl:element name="{$itemName}">
<xsl:value-of select="$itemName" />


the variable assignment to a value that passes through PHP is no problem; i can define that statically and the result is the same, which is this: the next element, <example>, is properly added to the document, and the dynamically generated variable $itemname is properly contained within the element. the element after that, however, causes a runtime error in the XSLT processor, and the only discernible difference to me is that i'm assigning the element name to a variable.

i'm admittedly quite new to XSLT! so there's likely something basic i missed. any advice or comments are greatly appreciated.

thanks very much.

Minollo I.Subject: Creating dynamically named elements
Author: Minollo I.
Date: 26 Dec 2007 06:45 PM
This question seems unrelated to Stylus Studio or out other XML products. You may find better assistance asking your general XSLT question to the XSLT list hosted at mulberrytech dot com.

Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.