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
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
dave livingstonSubject: dynamic element name
Author: dave livingston
Date: 28 Dec 2006 11:34 AM
I've been beating on this for awhile and cannot seem to make any headway. It cannot be as hard as I am making it.

I have an element whose text value is a class name in my input document.
I need to create an element (with some attributes) in the output document that has that class name. It sure seems pretty simple, but I cannot get anything to work.

I thought I could use AVT:
<xsl:element name = "{/root/response/res-body/class}" >
//attribute stuff//
</xsl:element>

When I test the stylesheet I get nothing with this example. If I put in a simple name (foo) then I get the element foo with all of the attributes.

Can someone please give me an idea what to check???

thanks

dave

Postnext
Minollo I.Subject: dynamic element name
Author: Minollo I.
Date: 28 Dec 2006 01:13 PM
If you get nothing I can only imagine that the XPath expression you are specifying for the name of the element is incorrect. If you post the XML document (or a sample of it) on which you are working, we may be able to help more.

Postnext
dave livingstonSubject: dynamic element name
Author: dave livingston
Date: 28 Dec 2006 02:29 PM
Here is an example source and the stylesheet...

I used the Xpath editor in Stylus Studio and it gave me the same path that I am using..it is almost like Stylus Studio does not support what I am trying to do...

arggh


Documenterror.xml
xml source

Unknownerror.xsl
stylesheet

Postnext
dave livingstonSubject: dynamic element name
Author: dave livingston
Date: 28 Dec 2006 02:46 PM
Interesting...if i change the processor from the internal to Saxon it will provide the output that I am looking for.

It would appear to be a bug within SS.

Posttop
Minollo I.Subject: dynamic element name
Author: Minollo I.
Date: 28 Dec 2006 03:21 PM
The problem is that you have whitespaces in the content of the element error-command; Saxon 8.7 will return this error:

Error: at xsl:element on line 22 of file:///c:/error.xsl:
XTDE0820: Invalid element name. Invalid QName { control }

Saxon 6.5.5 will return a similar error.

To fix the problem, just change your code into:
<xsl:element name="{normalize-space(/root/errorresponse/error-body/error-command)}">

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
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!  
go

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.