This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in retrieving attribute value

 
Priyadarshini Anand
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am writing XSLT for the following XML file

<TestReport>

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

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

</TestReport>

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

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
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
xmlns:tr="http://oracle/tipqa/fw/b2b/xmlmodel/testreport"
...
</xsl:stylesheet>

then you can access it like
/tr:testReport/tr:TestReport

Will that help you to get started ?
 
Priyadarshini Anand
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Thanx,
Priya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic