[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: instance-of schema-element

Subject: Re: instance-of schema-element
From: John Snelson <john.snelson@xxxxxxxxxx>
Date: Fri, 14 Mar 2008 15:44:55 +0000
Re:  instance-of schema-element
Hi Andrew,

I think you can accomplish what you want using lax validation and "instance of" in XPath 2.0. The basic idea would be to perform lax validation, and then check if the validation succeeded using "instance of".

John

Andrew Welch wrote:
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?



--
John Snelson, Oracle Corporation            http://snelson.org.uk/john
Berkeley DB XML:        http://www.oracle.com/database/berkeley-db/xml
XQilla:                                  http://xqilla.sourceforge.net

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.