This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes XSLT format transformation? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT format transformation?" Watch "XSLT format transformation?" New topic
Author

XSLT format transformation?

bujin wang
Ranch Hand

Joined: Jun 21, 2003
Posts: 48
Hi Developers,
Recently I am working with two version of xml files. They essentially provide the same information. Some tags are moved around; some are renamed. Currently the parser can only parse one version. I have got the option to extend the old parser to parse the new format. However I heard that XSLT could the transformation for me. That way I don't have to worry about parsers. There are some changes I am not sure whether XSLT could handle. for example:

In our old format, c is under b.

[CODE]
---------------------------------------------------------------------------
a
b
c
This is c
/c
/b
/a
In the new format, c is moved from b, but still b needs to refer to c:
<a>
<b refName="aaa">
...
</b>
</a>
<c name="aaa">
this is c
</c>
---------------------------------------------------------------------------
As we can see, the c in the new format is included through name attribute.
Can xslt template handle this?
What does the stylesheet look like in this case?
Thanks,
Bujin
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XSLT format transformation?