File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml to xml conversion using xslt" Watch "xml to xml conversion using xslt" New topic

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

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

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

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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.

I agree. Here's the link:
subject: xml to xml conversion using xslt
It's not a secret anymore!