xsl-list
[Top] [All Lists]

RE: [xsl] [XSLT 2.0] Checking that an element's value has the desired datatype?

2006-10-17 03:57:48
As stated earlier I don't believe he wants to get the type, he wants
to constrain the value,  and as for me I am not at all interested in
the type.

Exactly right.  Thanks Bryan.

I sense that ya'll are wondering where I am going with this?

Schematron + xPath 2.0 is extremely powerful.  In fact, one could argue
that it can do everything that XML Schema (or RelaxNG) can do, plus a
lot more.  

For example, below is an XML document showing information about an
aircraft and vertical obstructions on its flight path.  One critical
operational constraint is:

"Check that the aircraft's altitude is at least 500 feet above all the
vertical obstructions"

This "co-constraint" cannot be expressed using XML Schemas (or
RelaxNG).

But with Schematron + xPath 2.0 the co-constraint can be expressed
using this xPath:

every $j in flt:VerticalObstruction satisfies if ($j/flt:Height) then
number(flt:Aircraft/flt:Altitude) gt number($j/flt:Height +
$j/flt:Elevation + 500) else number(flt:Aircraft/flt:Altitude) gt
number($j/flt:Elevation + 500)

As best I can tell, the functionality of Schematron + xPath 2.0 is a
superset of XML Schemas (and RelaxNG).  However, I am still researching
this.  The findings in this discussion will be incorporated into a
paper I am writing.

I appreciate all your input.  /Roger

<?xml version="1.0"?>
<Flight xmlns="http://www.aviation.org";>
    <Aircraft type="Boeing 747">
        <Altitude units="feet" reference="MSL">3300</Altitude>
        <Location>
            <Latitude>42.371</Latitude>
            <Longitude>-71.000</Longitude>
        </Location>
    </Aircraft>
    <VerticalObstruction type="tower">
        <!-- The top of the tower is 1500 feet -->
        <Elevation units="feet">1000</Elevation>
        <Height units="feet">500</Height>
        <Location>
            <Latitude>42.371</Latitude>
            <Longitude>-71.025</Longitude>
        </Location>
    </VerticalObstruction>
    <VerticalObstruction type="mountain">
        <Elevation units="feet">2600</Elevation>
        <Location>
            <Latitude>42.371</Latitude>
            <Longitude>-71.155</Longitude>
        </Location>
    </VerticalObstruction>
    <VerticalObstruction type="building">
        <!-- The top of the building is 700 feet -->
        <Elevation units="feet">500</Elevation>
        <Height units="feet">200</Height>
        <Location>
            <Latitude>42.371</Latitude>
            <Longitude>-71.299</Longitude>
        </Location>
    </VerticalObstruction>
</Flight>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>