W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Select specific node and namespaces

From: Francis Norton <francis@redrice.com>
Date: Wed, 12 Jun 2002 14:27:24 +0100
Message-ID: <3D074C3C.1030202@redrice.com>
To: "Snow, Corey" <csnow@deltadentalwa.com>
CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>, Rick Jelliffe <ricko@topologi.com>

Hi Corey,

Snow, Corey wrote:

>All pretty straightforward so far, I'd guess. However, when a node fails to
>be validated against the Schematron rules, I'd like to replace it. My
>validating stylesheet, generated by schematron-xml.xsl, produces output that
>contains a "failed-assert" node for each instance node that failed to be
>validated for whatever reason. One of the properties of the failed-assert
>node is a property called "Location". It contains something like the
presumably these elements are in the default namespace. I hadn't 
realised that name() returns an unqualified name for nodes that are in a 
non-blank default namespace.


>However, if I add
>the namespace before the query:
>objXMLDoc.setProperty "SelectionNamespaces", "xmlns:myns="mynamespaceURN"
>It still fails unless I modify the XPath to something like:
Have you tried:

    objXMLDoc.setProperty "SelectionNamespaces", "xmlns=mynamespaceURN"

to set the default namespace? Don't worry if it doesn't work, see 

>Another thing I'm considering is trying to modify "schematron-xml.xsl" so it
>generates fully namespace-qualified XPath, but I'd prefer not to do that
>unless I have to. I don't think it would be very portable
Well, you could replace the template in skeleton1-5.xsl with this one 
line mod:

            <!-- utility routine for implementations -->
            <axsl:template match="*|@*" mode="schematron-get-full-path">
                <axsl:apply-templates select="parent::*" 
                <axsl:if test="count(. | ../@*) = count(../@*)">@</axsl:if>
                <axsl:if test="not(namespace-uri(.)='') and 
not(contains(name(.), ':'))">_dns:</axsl:if>
                <axsl:value-of select="name()"/>

It's a bit of a hack since it arbitrarily associates the prefix "_dns:" 
with what was the default namespace - I'd be open to better suggestions.

Received on Wednesday, 12 June 2002 09:29:31 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC