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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT

Status
Not open for further replies.

JontyMC

Programmer
Nov 26, 2001
1,276
0
0
GB
XML:

Code:
<doc>
  <metadata>data</metadata>
  <content>content</content>
</doc>

XSLT:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.1" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
  <xsl:output method="html" />
  <xsl:template match="content">
    <html>
      <body>
        <p><xsl:value-of select="." /></p>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

In IE it displays "datacontent", whereas in firefox it displays "content", which is what I expected. Whats going on there?

Jon
 
Your template match is only the content

<xsl:template match="content">

Use instead of this

<xsl:template match="/"> referring to the hole file

Any help?
 
I only want to match the content, in reality my content has child elements. I dont want to have to keep referring to them by content/elementname. I only want to display the content.

Thanks for the effort though (ps hole is spelt whole in this context).
 
add this template:

<xsl:template match="/">
<xsl:apply-templates select="//content[1]"/>
</xsl:template>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top