File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Simple XSL Probelem in retrieving value Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Simple XSL Probelem in retrieving value" Watch "Simple XSL Probelem in retrieving value" New topic
Author

Simple XSL Probelem in retrieving value

Doshi Milan
Ranch Hand

Joined: May 29, 2001
Posts: 112
Hello friends,
I have some very basic probelem of trying to retrieve the content of a Node which is of
mixed type. i.e:
My XML code is like this:
<?xml version='1.0'?>
<Institute>
MCS Software
<Franchisee>Dadar
<Courses>
<Course type="PT">
<Name>Java</Name>
<Cost>20000</Cost>
</Course>
:
:
I am trying to retrieve the value of the <Institute> in my xsl as follows:
<xsl:template match="/">
<html>
<body bgcolor="orange">
<h1><xsl:value-of select="Institute"/></h1>

</body>
</html>
</xsl:template>

I am not able to retrieve only MCS SOftware,instead I get the values of ALL Child Nodes within the Institute tag.
Th probelem is again repeated for the Franchisee tag also.
Can someone suggest the right soln for such 'mixed' tags.
Thanks in advance.
Regards,
Milan Doshi
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
You can use <xsl:value-of select="Institute/text()"/> - it will output only PCDATA without child elements.


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Doshi Milan
Ranch Hand

Joined: May 29, 2001
Posts: 112
Thanks a Lot for your valued help.
regards,
Milan
 
 
subject: Simple XSL Probelem in retrieving value
 
Threads others viewed
Mock exam question
Fetching TagName in XSL
XSL to html conversion
HTML Tags in XML file
passing parameters
developer file tools