Re: [xsl] Avoiding boneheaded mistakes in XSLT?

Subject: Re: [xsl] Avoiding boneheaded mistakes in XSLT?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 29 Dec 2010 19:38:33 +0000
> So for some C you will have errors/unmatched xpaths
> others you won't.
>  I'd prefer to know of them rather than 'assume'
> they are OK.

It sounds like you are asking the (non schema aware) processor to
report warnings for content that isn't present?

You can kind of do that sort of thing by using the as attribute:

<xsl:template match="whatever">
  <xsl:variable name="foo" select="path/to/foo" as="element(foo)"/>
  <xsl:apply-templates select="$foo"/>

The above will fail with an error if foo is not a child of whatever/path/to.

Andrew Welch

Current Thread