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 xsl for xml tags with similar name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xsl for xml tags with similar name" Watch "xsl for xml tags with similar name" New topic

xsl for xml tags with similar name

raj agastya

Joined: Nov 27, 2001
Posts: 22
I have an XML file like the following. I need to write an XSL file which will display the following columns of every tag(<col> under each tag(<row> . How do I do this? My sample XSL is also posted below XML which does not display the xml info in the table. Please help me.
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="" version="1.0">
<xsl:template match="row">
<FONT COLOR="#CC0000" SIZE="+1">
<B>List of Products</B>
<xsl:for-each select="/RowSet/data/row">
<xsl:value-of select="col"/>
<FORM ACTION="../jsps/Main.jsp" METHOD="post">
<INPUT TYPE="SUBMIT" NAME="Back" VALUE="Back To Main Page"/>
Thank you and regards,
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
You're matching on "row", but you're also doing a foreach on /RowSet/data/row . Do one or the other, not both.

Ron Newman - SCJP 1.2 (100%, 7 August 2002)

Joined: Jul 21, 2003
Posts: 23
Replace the corresponding lines with these:

<xsl:template match="data">
<xsl:for-each select="row">
That's all. It will work

<a href="" target="_blank" rel="nofollow">MQMessenger</a> - free Java app for MQSeries
I agree. Here's the link:
subject: xsl for xml tags with similar name
It's not a secret anymore!