Re: XSL Theory

Subject: Re: XSL Theory
From: crism@xxxxxxxxxxxxx (Christopher R. Maden)
Date: Thu, 9 Mar 2000 02:20:40 -0800
[Jon Smirl]
>Suppose I have an XML document conforming to Schema A and I want to
>transform it into a document that conforms to Schema B. Has any work been
>done trying to prove that my stylesheet will always generate a valid
>document?

Given a particular input document, it's obviously possible (in the trivial
case, just process the document and check the output).  Given only a
schema, it's not generally possible.  However, a sufficiently sophisticated
analyzer could tell you that a transformation sheet will always generate a
document compliant with Schema B; will never generate a document compliant
with Schema B; or may generate a document compliant with Schema B depending
on the exact input document.

As a simple case, imagine Schema B allows exactly one empty <b/>.  A
stylesheet might have:

<xsl:template match="/"><b/></xsl:template>

or

<xsl:template match="/"><xyzzy>FOO!</xyzzy></xsl:template>

or

<xsl:template match="/">
  <xsl:choose>
    <xsl:when test=". = 'yes'"></b></xsl:when>
    <xsl:otherwise><xyzzy>FOO!</xyzzy></xsl:otherwise>
  </xsl:choose>
</xsl:template>

corresponding to the three cases enumerated above.

-Chris

--
Christopher R. Maden, Solutions Architect
Yomu (formerly Exemplary Technologies)
One Embarcadero Center, Ste. 2405
San Francisco, CA 94111



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread