wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes problem in retrieving attribute value 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 "problem in retrieving attribute value" Watch "problem in retrieving attribute value" New topic

problem in retrieving attribute value

Priyadarshini Anand

Joined: Jun 02, 2004
Posts: 22

I am writing XSLT for the following XML file


<TestCaseReport result="pass" sequence="1" id="3A4" xmlns="http://oracle/tipqa/fw/b2b/xmlmodel/testreport">
<reportData state="started"/>

<TestCaseReport result="fail" sequence="2" id="3A6" xmlns="http://oracle/tipqa/fw/b2b/xmlmodel/testreport">
<reportData state="started"/>


XSLT is as follows :
<xsl:for-each select="/TestReport/TestCaseReport">
<td><xsl:value-of select="@sequence"/></td>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="@result"/></td>

XSLT is not displaying the table.But if i will remove xmlns attribute of TestCaseReport tag then the table is displayed.

please help me to solve this problem.Without removing xmlns attribute of TestCaseReport tag how to display the table
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
You can try adding /{http://oracle/tipqa/fw/b2b/xmlmodel/testreport}TestReport /{http://oracle/tipqa/fw/b2b/xmlmodel/testreport}TestCaseReport
but its like
So try adding the namespace to the XSLT stylesheet like
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

then you can access it like

Will that help you to get started ?

Spritle Software Blogs
Priyadarshini Anand

Joined: Jun 02, 2004
Posts: 22
thankyou,Second approach is working, though in first some problem i have.
Actually what project i am developing ,the first approach u said looks more suitable as there are many xml files accessing the same XSL file. so xmlns attribute will be different in different XML that i should retrieve using @.I hope u understood what I want to say.pl help me

I agree. Here's the link: http://aspose.com/file-tools
subject: problem in retrieving attribute value