XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
ISO Schematron Skeleton implementation: How to pass namespacedefinition


Hello,

I am trying to use the ISO Schematron Skeleton implementation at:

http://www.schematron.com/implementation.html

My schematron file is validating a WSDL input file. The problem is that the final XSLT generated by ISO Schematron Skeleton implementation does not have namespaces defined for wsdl and soap but the schematron file I use to validate WSDL input files has them defined correctly.

I am attaching:
  • The Schematron file to validate the WSDL input file 
  • The WSDL input file
  • The generated XSLT file from the skeleton implemntation that is missing the namespace defs for soap and wsdl namespace prefixes.

How can I fix this so the generated XSLT has teh soap and wsdl namespaces defined? TIA for your help.
 
-- 
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com

<?xml version = "1.0" encoding = "UTF-8"?>
<!-- $Header: /cvsroot/ebxmlrr/omar/misc/samples/extDB/ws/InvocationControlFile_WSDLValidation.schematron,v 1.2 2005/11/21 15:52:38 farrukh_najmi Exp $ -->
<schema 
  xmlns="http://purl.oclc.org/dsdl/schematron";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://purl.oclc.org/dsdl/schematron  http://markmail.org/download.xqy?id=3hmiyx4y3pnllpzi&amp;number=1";
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
  >
	<title>A Schematron rules file for validating WSDL according to the ebXML Registry profile for Web Services</title>
  <pattern>
    <rule context="wsdl:binding">
  	<assert test="soap:binding">message.errorBindingMustBeSoap</assert>
    </rule>
  </pattern>
  <!--pattern>
    <rule context="soap:binding">
  	<assert test="string(@style) = 'document'">message.errorBindingStyleMustBeDocument</assert>
    </rule>
  </pattern-->
  <pattern>
    <rule context="soap:binding">
        <assert test="string(@transport) = 'http://schemas.xmlsoap.org/soap/http'">message.errorTransportMustBeHttp</assert>
    </rule>
  </pattern>
</schema>

<?xml version="1.0" encoding="UTF-8"?>
<definitions
    name="WeatherSummary"
    targetNamespace="http://www.roguewave.com/soapworx/examples/WeatherSummary.wsdl";
    xmlns="http://schemas.xmlsoap.org/wsdl/";
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
    xmlns:tns="http://www.roguewave.com/soapworx/examples/WeatherSummary.wsdl";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    xmlns:wsx="http://www.roguewave.com/soapworx/examples/WeatherSummary.xsd";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/ http://schemas.xmlsoap.org/wsdl";
    >
    <types>
        <xsd:schema
            targetNamespace=
            "http://www.roguewave.com/soapworx/examples/WeatherSummary.xsd";
            xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
            xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
            <xsd:complexType name="WeatherSummary">
                <xsd:sequence>
                    <xsd:element maxOccurs="1" minOccurs="1" name="zipcode"
                                 nillable="true" type="xsd:string"/>
                    <xsd:element maxOccurs="1" minOccurs="1" name="windSpeed"
                                 nillable="true" type="xsd:unsignedInt"/>
                    <xsd:element maxOccurs="1" minOccurs="1" name="sky"
                                 nillable="true" type="xsd:string"/>
                    <xsd:element maxOccurs="1" minOccurs="1" name="temp"
                                 nillable="true" type="xsd:int"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>
    </types>
    <message name="getSummary">
        <part name="zipcode" type="xsd:string"/>
    </message>
    <message name="updateWeather">
        <part name="weatherData" type="wsx:WeatherSummary"/>
        <part name="port" type="xsd:string"/>
        <part name="transportName" type="xsd:string"/>
    </message>
    <message name="getSummaryResponse">
        <part name="weatherData" type="wsx:WeatherSummary"/>
    </message>
    <portType name="WeatherSummary">
        <!-- request-responserequest-response -->
        <operation name="getSummary">
            <input message="tns:getSummary"/>
            <output message="tns:getSummaryResponse"/>
        </operation>
        <!-- One-way -->
        <operation name="updateWeather">
            <input message="tns:updateWeather"/>
        </operation>
        <!-- Notification -->
        <operation name="weatherNotification">
            <output message="tns:getSummaryResponse"/>
        </operation>
    </portType>
    <binding name="WeatherSummary" type="tns:WeatherSummary">
        <soap:binding style="rpc"
                      transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="getSummary">
            <soap:operation soapAction="getSummary"/>
            <input>
                <soap:body use="encoded"
                           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
                           namespace="http://www.roguewave.com/soapworx/examples"/>
                <soap:header message="tns:getSummary" part="header" use="literal"/>
            </input>
            <output>
                <soap:body use="encoded"
                           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
                           namespace="http://www.roguewave.com/soapworx/examples"/>
            </output>
        </operation>
        <operation name="updateWeather">
            <soap:operation soapAction="updateWeather"/>
            <input>
                <soap:body use="encoded"
                           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
                           namespace="http://www.roguewave.com/soapworx/examples"/>
            </input>
        </operation>
        <operation name="weatherNotification">
            <soap:operation soapAction="weatherNotification"/>
            <output>
                <soap:body use="encoded"
                           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
                           namespace="http://www.roguewave.com/soapworx/examples"/>
            </output>
        </operation>
    </binding>
    <service name="WeatherSummary">
        <documentation>WeatherSummary</documentation>
        <port name="WeatherSummary" binding="tns:WeatherSummary">
            <soap:address
                location="http://localhost:8090/weather/WeatherSummary"/>
        </port>
    </service>
</definitions>


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:sch="http://www.ascc.net/xml/schematron";
                xmlns:iso="http://purl.oclc.org/dsdl/schematron";
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0"><!--Implementers: please note that overriding process-prolog or process-root is
    the preferred method for meta-stylesheets to use where possible. -->
<xsl:param name="archiveDirParameter"/>
   <xsl:param name="archiveNameParameter"/>
   <xsl:param name="fileNameParameter"/>
   <xsl:param name="fileDirParameter"/>

   <!--PHASES-->


<!--PROLOG-->
<xsl:output xmlns:svrl="http://purl.oclc.org/dsdl/svrl";
               xmlns:xs="http://www.w3.org/2001/XMLSchema";
               xmlns:schold="http://www.ascc.net/xml/schematron";
               method="xml"
               omit-xml-declaration="no"
               standalone="yes"
               indent="yes"/>

   <!--KEYS-->


<!--DEFAULT RULES-->


<!--MODE: SCHEMATRON-SELECT-FULL-PATH-->
<!--This mode can be used to generate an ugly though full XPath for locators-->
<xsl:template match="*" mode="schematron-select-full-path">
      <xsl:apply-templates select="." mode="schematron-get-full-path"/>
   </xsl:template>

   <!--MODE: SCHEMATRON-FULL-PATH-->
<!--This mode can be used to generate an ugly though full XPath for locators-->
<xsl:template match="*" mode="schematron-get-full-path">
      <xsl:apply-templates select="parent::*" mode="schematron-get-full-path"/>
      <xsl:text>/</xsl:text>
      <xsl:choose>
         <xsl:when test="namespace-uri()=''">
            <xsl:value-of select="name()"/>
            <xsl:variable name="p_1" select="1+    count(preceding-sibling::*[name()=name(current())])"/>
            <xsl:if test="$p_1&gt;1 or following-sibling::*[name()=name(current())]">[<xsl:value-of select="$p_1"/>]</xsl:if>
         </xsl:when>
         <xsl:otherwise>
            <xsl:text>*[local-name()='</xsl:text>
            <xsl:value-of select="local-name()"/>
            <xsl:text>' and namespace-uri()='</xsl:text>
            <xsl:value-of select="namespace-uri()"/>
            <xsl:text>']</xsl:text>
            <xsl:variable name="p_2"
                          select="1+   count(preceding-sibling::*[local-name()=local-name(current())])"/>
            <xsl:if test="$p_2&gt;1 or following-sibling::*[local-name()=local-name(current())]">[<xsl:value-of select="$p_2"/>]</xsl:if>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
   <xsl:template match="@*" mode="schematron-get-full-path">
      <xsl:text>/</xsl:text>
      <xsl:choose>
         <xsl:when test="namespace-uri()=''">@<xsl:value-of select="name()"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:text>@*[local-name()='</xsl:text>
            <xsl:value-of select="local-name()"/>
            <xsl:text>' and namespace-uri()='</xsl:text>
            <xsl:value-of select="namespace-uri()"/>
            <xsl:text>']</xsl:text>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--MODE: SCHEMATRON-FULL-PATH-2-->
<!--This mode can be used to generate prefixed XPath for humans-->
<xsl:template match="node() | @*" mode="schematron-get-full-path-2">
      <xsl:for-each select="ancestor-or-self::*">
         <xsl:text>/</xsl:text>
         <xsl:value-of select="name(.)"/>
         <xsl:if test="preceding-sibling::*[name(.)=name(current())]">
            <xsl:text>[</xsl:text>
            <xsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1"/>
            <xsl:text>]</xsl:text>
         </xsl:if>
      </xsl:for-each>
      <xsl:if test="not(self::*)">
         <xsl:text/>/@<xsl:value-of select="name(.)"/>
      </xsl:if>
   </xsl:template>

   <!--MODE: GENERATE-ID-FROM-PATH -->
<xsl:template match="/" mode="generate-id-from-path"/>
   <xsl:template match="text()" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.text-', 1+count(preceding-sibling::text()), '-')"/>
   </xsl:template>
   <xsl:template match="comment()" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.comment-', 1+count(preceding-sibling::comment()), '-')"/>
   </xsl:template>
   <xsl:template match="processing-instruction()" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.processing-instruction-', 1+count(preceding-sibling::processing-instruction()), '-')"/>
   </xsl:template>
   <xsl:template match="@*" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.@', name())"/>
   </xsl:template>
   <xsl:template match="*" mode="generate-id-from-path" priority="-0.5">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:text>.</xsl:text>
      <xsl:value-of select="concat('.',name(),'-',1+count(preceding-sibling::*[name()=name(current())]),'-')"/>
   </xsl:template>
   <!--MODE: SCHEMATRON-FULL-PATH-3-->
<!--This mode can be used to generate prefixed XPath for humans
        (Top-level element has index)-->
<xsl:template match="node() | @*" mode="schematron-get-full-path-3">
      <xsl:for-each select="ancestor-or-self::*">
         <xsl:text>/</xsl:text>
         <xsl:value-of select="name(.)"/>
         <xsl:if test="parent::*">
            <xsl:text>[</xsl:text>
            <xsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1"/>
            <xsl:text>]</xsl:text>
         </xsl:if>
      </xsl:for-each>
      <xsl:if test="not(self::*)">
         <xsl:text/>/@<xsl:value-of select="name(.)"/>
      </xsl:if>
   </xsl:template>

   <!--MODE: GENERATE-ID-2 -->
<xsl:template match="/" mode="generate-id-2">U</xsl:template>
   <xsl:template match="*" mode="generate-id-2" priority="2">
      <xsl:text>U</xsl:text>
      <xsl:number level="multiple" count="*"/>
   </xsl:template>
   <xsl:template match="node()" mode="generate-id-2">
      <xsl:text>U.</xsl:text>
      <xsl:number level="multiple" count="*"/>
      <xsl:text>n</xsl:text>
      <xsl:number count="node()"/>
   </xsl:template>
   <xsl:template match="@*" mode="generate-id-2">
      <xsl:text>U.</xsl:text>
      <xsl:number level="multiple" count="*"/>
      <xsl:text>_</xsl:text>
      <xsl:value-of select="string-length(local-name(.))"/>
      <xsl:text>_</xsl:text>
      <xsl:value-of select="translate(name(),':','.')"/>
   </xsl:template>
   <!--Strip characters--><xsl:template match="text()" priority="-1"/>

   <!--SCHEMA METADATA-->
<xsl:template match="/">
      <svrl:schematron-output xmlns:svrl="http://purl.oclc.org/dsdl/svrl";
                              xmlns:xs="http://www.w3.org/2001/XMLSchema";
                              xmlns:schold="http://www.ascc.net/xml/schematron";
                              title="A Schematron rules file for validating WSDL according to the ebXML Registry profile for Web Services"
                              schemaVersion="">
         <xsl:comment>
            <xsl:value-of select="$archiveDirParameter"/>   
                 <xsl:value-of select="$archiveNameParameter"/>  
                 <xsl:value-of select="$fileNameParameter"/>  
                 <xsl:value-of select="$fileDirParameter"/>
         </xsl:comment>
         <svrl:active-pattern>
            <xsl:apply-templates/>
         </svrl:active-pattern>
         <xsl:apply-templates select="/" mode="M1"/>
         <svrl:active-pattern>
            <xsl:apply-templates/>
         </svrl:active-pattern>
         <xsl:apply-templates select="/" mode="M2"/>
      </svrl:schematron-output>
   </xsl:template>

   <!--SCHEMATRON PATTERNS-->
<svrl:text xmlns:svrl="http://purl.oclc.org/dsdl/svrl";
              xmlns:xs="http://www.w3.org/2001/XMLSchema";
              xmlns:schold="http://www.ascc.net/xml/schematron";>A Schematron rules file for validating WSDL according to the ebXML Registry profile for Web Services</svrl:text>

   <!--PATTERN -->


        <!--RULE -->
<xsl:template match="wsdl:binding" priority="1000" mode="M1">
      <svrl:fired-rule xmlns:svrl="http://purl.oclc.org/dsdl/svrl";
                       xmlns:xs="http://www.w3.org/2001/XMLSchema";
                       xmlns:schold="http://www.ascc.net/xml/schematron";
                       context="wsdl:binding"/>

                    <!--ASSERT -->
<xsl:choose>
         <xsl:when test="soap:binding"/>
         <xsl:otherwise>
            <svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl";
                                xmlns:xs="http://www.w3.org/2001/XMLSchema";
                                xmlns:schold="http://www.ascc.net/xml/schematron";
                                test="soap:binding">
               <xsl:attribute name="location">
                  <xsl:apply-templates select="." mode="schematron-get-full-path"/>
               </xsl:attribute>
               <svrl:text>message.errorBindingMustBeSoap</svrl:text>
            </svrl:failed-assert>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="*|comment()|processing-instruction()" mode="M1"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M1"/>
   <xsl:template match="@*|node()" priority="-2" mode="M1">
      <xsl:apply-templates select="*|comment()|processing-instruction()" mode="M1"/>
   </xsl:template>

   <!--PATTERN -->


        <!--RULE -->
<xsl:template match="soap:binding" priority="1000" mode="M2">
      <svrl:fired-rule xmlns:svrl="http://purl.oclc.org/dsdl/svrl";
                       xmlns:xs="http://www.w3.org/2001/XMLSchema";
                       xmlns:schold="http://www.ascc.net/xml/schematron";
                       context="soap:binding"/>

                    <!--ASSERT -->
<xsl:choose>
         <xsl:when test="string(@transport) = 'http://schemas.xmlsoap.org/soap/http'"/>
         <xsl:otherwise>
            <svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl";
                                xmlns:xs="http://www.w3.org/2001/XMLSchema";
                                xmlns:schold="http://www.ascc.net/xml/schematron";
                                test="string(@transport) = 'http://schemas.xmlsoap.org/soap/http'">
               <xsl:attribute name="location">
                  <xsl:apply-templates select="." mode="schematron-get-full-path"/>
               </xsl:attribute>
               <svrl:text>message.errorTransportMustBeHttp</svrl:text>
            </svrl:failed-assert>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="*|comment()|processing-instruction()" mode="M2"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M2"/>
   <xsl:template match="@*|node()" priority="-2" mode="M2">
      <xsl:apply-templates select="*|comment()|processing-instruction()" mode="M2"/>
   </xsl:template>
</xsl:stylesheet>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS