Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT Question

Status
Not open for further replies.

lbrooks

IS-IT--Management
Jan 20, 2004
42
US
I have a XSLT that looks like the following:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="<xsl:eek:utput method="html"/>
<xsl:template match="//MainHeader/MasterElement">
<xsl:apply-templates select="MainElement"/>
</xsl:template>
<xsl:template match="MainElement">
<xsl:value-of select="Description"/>
</xsl:template>
</xsl:stylesheet>

My XML Look like this

<MainHeader>
<MasterElement>
<MainElement>
<Description>Some Value</Description>
</MainElement>
</MasterElement>
</MainHeader>

Given the above XSLT, currently all elements show up when I transform the XML to HTML. I just want the description that I specified. Any Help.
 
I think the problem is
Code:
<xsl:value-of select="Description"/>

Maybe more like this:
Code:
<xsl:template match="Description">
 <xsl:value-of select="Some Value"/>
 
To Add, I know there is something I am just overlooking. Any help would be greatly appreaciated.
 
The "Some Value" is just the value of the element description. I want the value of the element description. So if this was working correctly it owuld just display the "Some Value" instead of all elements in the XML file. I do not show the other elements, but I think you get the just.
 
><xsl:apply-templates select="MainElement"/>
[tt]<xsl:apply-templates select="MainElement[blue][Description/text()='Some Value'][/blue]"/>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top