[thelist] Basic XSLT problem [bug fix]

Marcus Andersson marcan at home.se
Wed Jan 14 04:56:13 CST 2004


There should of course be one more template or there won't be any
surrounding data elements:

<xsl:template match="/">
  <data>
    <xsl:apply-templates/>
  </data>
</xsl:template>

/Marcus

Complete listing:

<?xml version="1.0" ?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output indent="yes" />

  <xsl:template match="/">
    <data>
      <xsl:apply-templates/>
    </data>
  </xsl:template>

  <xsl:template match="record">
    <record title="{@title}">
      <xsl:apply-templates select="@*[local-name() != 'title']"/>
    </record>
  </xsl:template>

  <xsl:template match="@*">
    <xsl:element name="{local-name()}">
      <xsl:value-of select="."/>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>



More information about the thelist mailing list