Re: [xsl] instance-of schema-element

Subject: Re: [xsl] instance-of schema-element
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 14 Mar 2008 14:58:36 +0000
On 14/03/2008, Florent Georges <lists@xxxxxxxxxxxx> wrote:
> Andrew Welch wrote:
>
>  > <xsl:if test="$foo instance of schema-element(foo)">
>
>  > ...does that mean $foo is validated at that point?
>
>
>   No.  That will test if the dynamic type of $foo already matches
>  schema-element(foo).

hmmm thought so - how can I validate $foo without it causing the
transform to fail?

The problem I'm trying to solve is along the lines of:

- $foo and $bar are both hold very similar similar XML ( a before and
after view of some XML in fact)

- if $foo is valid and $bar isn't, output $foo and vice versa

- if both are valid apply an extra layer of logic to decide which is output

- if neither are valid output nothing

With this approach I need some way of validating the XML from within
the XSLT and then be able to handle any validation failures...
something like:

<xsl:variable name="foo" as="document-node(schema-element(foo))">
  <xsl:document validation="strict">
    <foo/>
  </xsl:document>
</xsl:variable>

...that won't cause the transform to fail, but allow me to test
whether $foo is valid.

Any ideas?

-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread