Jez Higgins

Freelance software generalist
software created
extended or repaired


Older posts are available in the archive or through tags.

Feed

Follow me on Twitter
My code on GitHub

Contact
About

Tuesday 23 May 2006 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.


Tagged code, xml, and xslt


Jez Higgins

Freelance software generalist
software created
extended or repaired

Older posts are available in the archive or through tags.

Feed

Follow me on Twitter
My code on GitHub

Contact
About