[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Transforming an XML document where the content isn

Subject: Re: Transforming an XML document where the content isn't in a special tag
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Wed, 17 Aug 2005 11:44:59 +0530
Re:  Transforming an XML document where the content isn
Sorry, I was wrong.

The correct XSLT 1.0 stylesheet is -

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="yes"/>

<xsl:template match="/root">
    <html>
      <head>
        <title/>
      </head>
      <body>
        <xsl:apply-templates select="header" />
      </body>
    </html>
</xsl:template>

<xsl:template match="header">
    <h1><xsl:value-of select="." /></h1>
    <xsl:call-template name="printTextNode">
      <xsl:with-param name="nodelist"
select="following-sibling::node()[1] | following-sibling::node()[2]"
/>
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="printTextNode">
    <xsl:param name="nodelist" />
    <p>
      <xsl:for-each select="$nodelist">
        <xsl:choose>
          <xsl:when test="name() = 'a'">
            <xsl:copy-of select="." />
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="." />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </p>
</xsl:template>

</xsl:stylesheet>

Hope this helps,

Regards,
Mukul

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.