[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

creating nodes from text

Subject: creating nodes from text
From: omprakash.v@xxxxxxxxxxxxx
Date: Wed, 6 Apr 2005 15:15:38 +0530
outside of element xsl
        I am working on an inverse transform where Iam trying to get back
the original xml from the transformed output. Towards this, Iam trying to
make all the text in certain places in the result into element nodes. Iam
facing a problem while adding attributes to the element Iam creating thus.

My input xml is as follows:

<a href="file:///N400002">(-)</a>slideshow
     <td>title</td><td>Sample Slide Show</td>
     <td>date</td><td>Date of publication</td>
     <td>author</td><td>Yours Truly</td>

The  text of the first td that is the child of /table/tr  (slideshow) is my
The attributes are stored 1 per row in the next td in a table of their own.

My xsl looks like this:

     <xsl:if test="*[1][name() = 'a'] and not(. = '')">

     <xsl:variable name="elemname" select="normalize-space(text())"/>

          <xsl:element name="{$elemname}">

          <xsl:for-each select="../*[2][name() = 'td']/*[1]/*[1]">

               <xsl:variable name="attrname" select="*[1]"/>
               <xsl:variable name="attrval" select="*[2]"/>

               <xsl:attribute name="{$attrname}">
               <xsl:value-of select="td[1]"/>



The problem is:

I am getting the error "Attribute '{$attrname}' outside of element.". Iam
only adding the attributes in a for-each to the slideshow element I have
The other parst I don't understand are, the above works (not considering
the above problem) only when I use wildcards in the for-each like
<xsl:for-each select="../*[2][name() = 'td']/*[1]/*[1]">.

The other question is do I need the variables or could I do without them.

Be much grateful for any help.


This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.