aspose file tools
The moose likes XML and Related Technologies and the fly likes xml to xml conversion using xslt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "xml to xml conversion using xslt" Watch "xml to xml conversion using xslt" New topic
Author

xml to xml conversion using xslt

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All

I am rendering a new xml from an existing xml using XSLT.
In the xslt i was able to create the xml document when all I had to do was fetch values from the source xml & create just new elements in the destination xml.

Now I have to create an xml element which also has an attribute
& because the java SAX parser transformation fails giving errors like expected to terminate element tag started earlier.

If I remove this piece everything goes well
This is the part which is creating the problem in the xsl

------------
<channel
channelType="subChannel"
vcmName="<xsl:value-of select='$includeParent'/><xsl:value-of select='node_name'/>">
</channel>
------------


First of all it errors out saying < cannot be used & to use "<" which i did.

If i use the same xsl piece as element value & not attributes everything works fine.
The problem occurs only when I m trying to create element attribute values

Do post your thoughts on the same

Regards,
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16479
    
    2

I think that you could use Attribute Value Templates like this:Here's the link to an entry in the XSLT FAQ that talks about them.
manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hey Paul,

Thanks a lot. That worked.

Regards,
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: xml to xml conversion using xslt
 
Similar Threads
simple question for xslt
XSLT questions
use XSLT to copy attribute/element and generate element
insertion of records from one database to another using xml
some notes on xml