Hi Folks,
Apparently I am not correctly understanding this XPath statement:
    if (//test instance of schema-element(test)) then  
        //test * 2 
    else 'Error'
My understanding of the XPath is this: "If the <test> element in the
input document conforms to the declaration of test in the XML Schema
then multiply its value by 2, otherwise output Error."
 
I have an XML Schema in which I declare the <test> element.  The <test>
element in the input XML document conforms to the Schema declaration.
So, I expected the XPath statement to execute the if-statement.
Instead, it executes the else-statement.  Thus, the output is: Error.
What am I doing wrong?
I am using the schema-aware version of SAXON, version 8.9.0.4j.  Below
is the stylesheet, XML Schema, and XML document.
Any help would be much appreciated.
/Roger
----------------------------------------------------------
STYLESHEET (test.xsl)
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="2.0">
 
    <xsl:output method="text"/>
    <xsl:import-schema schema-location="test.xsd"/>
    <xsl:template match="/">
        <xsl:value-of select="if (//test instance of
schema-element(test)) then  
                              //test * 2 
                              else 'Error'"/>
         
    </xsl:template>
</xsl:stylesheet>
----------------------------------------------------------
XML SCHEMA (test.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified">
    <xs:element name="test" type="xs:integer"/>
</xs:schema>
----------------------------------------------------------
XML DOCUMENT (test.xml)
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="test.xsd">
   120
</test>
--~------------------------------------------------------------------
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>
--~--