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 Query relating to transforming XML using XSL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Query relating to transforming XML using XSL" Watch "Query relating to transforming XML using XSL" New topic

Query relating to transforming XML using XSL

Rubal Sidhu

Joined: Aug 24, 2002
Posts: 14
Hi all,
I am new to XSL & I have 2 doubts.
I have a XML file & using a XSL file I have to extract a portion of input XML(say SuperXML) to get a new XML(say subXML).The XSL file has to read a properties or CSV file to fetch some IDs & for each ID picked XSL has to transfrom super XML to generate subXML.Question, XSL is reading 2 files,properties/CSV & SuperXML,how can I do this.Is it possible that XSL reads 2 input files.I hope I m not confusing you.
Now,a simple one I have following skeleton of a XML file

& I want to get data from 2 <catchme> tags.I am using following in XSL but it is not getting data.Please advise where I m wrong.

Thanks in advance.

<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl utput method="xml" encoding="ISO-8859-1" indent="yes" />

<!-- tag1 -->
<xsl:template match="/">

<!-- tag2 -->
<xsl:template match="tag1/tag2">
<xsl:apply-templates select="tag3"/>

<!-- tag3 -->
<xsl:template match="tag1/tag2/tag3">
<xsl:for-each select="catchme">
<catchme><xsl:value-of select="catchme"/></catchme>
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
You can read the external xml files using document() function of xslt, check some xslt tutorials to learn the usage. tutorials were also good.

Spritle Software Blogs
It is sorta covered in the JavaRanch Style Guide.
subject: Query relating to transforming XML using XSL
It's not a secret anymore!