2006-05-23  XSLT Scrapbook: The default is probably not what you want

The empty stylesheet almost certainly does the wrong thing.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

</xsl:stylesheet>

The default processing is equivalent to

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

<xsl:template match="text()">
  <xsl:value-of select="."/>
</xsl:template>

All the text gets dumped out and everything else is lost. When starting a new stylesheet, you probably want to start by passing through everything or suppressing everything. You almost certainly do not want the default behaviour.

Enter your comment

Name Email
URL
If you have an account, please log in.
No account? Just create one.


Jez Higgins