xalan-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shath...@e-z.net
Subject Re: mapping a prefix to a namespace URI
Date Wed, 25 Sep 2013 20:07:51 GMT

Without additional C++ programming, and you have an XML document
that associates with xmlns="http://someweb.com" your stylesheet
can assign a prefix (my) to your namespace by using
xmlns:my="http://someweb.com" in your stylesheet or transform


and your document can look like:

 <mydoc xmlns="http://someweb.com">
   ... document content

And the XSLT transformations now know how to use the my: prefix
for your nodes.  If the <xsl:transform> element also has
xmlns="http://someweb.com" then the common XPath functions may

I don't remember what the linkage is to register namespace_names
to the namespace property at this time for XalanTransformer and
XPath runtime configuration structures.

Steven J. Hathaway

> Thank you very much for your reply Steven.
> My xml has xmlns="http://someweb.com" (i.e. no prefix which is what I've
> always understood to be referred to as having default namespace).
> If you run a series of XML through the Xalan SimpleXPathAPI sample then,
> if
> you have no name space (no xmlns at all in the doc), you can use XPath
> like
> "/node1/node2/etc" and if you have a defined namespace, you can use XPath
> like /myns:node1/myns:nod2e/myns:etc.  But if you run a document with
> "default namespace"  through the SimpleXPathAPI sample, it returns no node
> found.
> I've also found that when you interrogate a document like this in XMLQuire
> it puts out "/dft:node1/dft:node2/dft:etc".
> I found a few post where folks had hit this same issue and were told to"
> "You'll also need to implement a PrefixResolver derivative and pass an
> instance of that into the XPathEvaluator, so the XPath implementation can
> map the namespace prefix to the proper namespace URI.  You can look at the
> existing PrefixResolver instances to see what's involved."  -Dave Bertoni
> http://apache-xml-project.6118.n7.nabble.com/xpath-expression-with-namespace-td22110.html#a22111
> That post is rather old an maybe I'm heading in the wrong direction as
> there
> may be better ways to do this now.
> Thanks again for any help you can give me.
> Aaron
> --
> View this message in context:
> http://apache-xml-project.6118.n7.nabble.com/mapping-a-prefix-to-a-namespace-URI-tp40498p40507.html
> Sent from the Xalan - C - Users mailing list archive at Nabble.com.

View raw message