wood burning stoves 2.0*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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="http://www.w3.org/1999/XSL/Transform" 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="http://www.mqtips.com" target="_blank" rel="nofollow">MQMessenger</a> - free Java app for MQSeries
It is sorta covered in the JavaRanch Style Guide.
subject: xsl for xml tags with similar name
Similar Threads
Remove unwanted space before and after the table using javascript
using MSXML3 (DOM) within JSP
xsl: create href for one tag with value in param among multiple
Using XSL to display XML
PLEASE HELP ME!!Creating drop down list using XSL