- From: Snow, Corey <csnow@deltadentalwa.com>
- Date: Wed, 12 Jun 2002 12:32:12 -0400 (EDT)
- To: "'Francis Norton'" <francis@redrice.com>
- Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>, Rick Jelliffe <ricko@topologi.com>
Rick, I'm keeping you in the CC: line because you may be interested in this discussion- or not. If not, just say the word- thanks. :) > -----Original Message----- > From: Francis Norton [mailto:francis@redrice.com] > Sent: Wednesday, June 12, 2002 6:27 AM > To: Snow, Corey > Cc: 'xmlschema-dev@w3.org'; Rick Jelliffe > Subject: Re: Select specific node and namespaces > > Hi Corey, > Hi Francis- thanks for your response. > 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 > >following: > > > >/topic[1]/content[1]/para[1]/link[1] > > > > > 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. > I'm not sure if this is appropriate behavior or not. My reading of the spec isn't clear on whether or not a namespace should be returned for a non-blank default namespace, which is the case here. > <snip/> > > >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: > >/myns:topic[1]/myns:content[1]/myns:para[1]/myns:link[1] > > > Have you tried: > > objXMLDoc.setProperty "SelectionNamespaces", > "xmlns=mynamespaceURN" > Good idea- yes, I tried that and variations on it. No joy. ;) > to set the default namespace? Don't worry if it doesn't work, see > below... > > >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::*" > mode="schematron-get-full-path"/> > <axsl:text>/</axsl:text> > <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()"/> > <axsl:text>[</axsl:text> > <axsl:value-of > select="1+count(preceding-sibling::*[name()=name(current())])"/> > <axsl:text>]</axsl:text> > </axsl:template> > > 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. > This is something (similar to) what I had considered. As you said, it associates a string with that namespace- I could use my own namespace prefix as well. But that destroys portablility, which is OK for this one application, but I'd prefer a cleaner solution. Again, thanks for your response. Regards, Corey Snow ######################################################### The information contained in this e-mail and subsequent attachments may be privileged, confidential and protected from disclosure. This transmission is intended for the sole use of the individual and entity to whom it is addressed. If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited. If you think that you have received this message in error, please e-mail the sender at the above e-mail address. #########################################################
Received on Thursday, 13 June 2002 04:08:50 UTC