[XML-SIG] XPath and namespaces
Uche Ogbuji
uogbuji@fourthought.com
Mon, 07 Aug 2000 20:06:44 -0600
> What is the syntax to get a namespaced node using xpath.
>
> Eg.
>
> <some-node>
> <xsl:transform xmlns:xsl="the right stuff here" />
> </somenode>
>
> With 4XPath, I tried "some-node/transform" and "some-node/xsl:transform" both
> returned an empty list.
"some-node/xsl:transform". But if you're using 4XPath outside of 4XSLT,
you'll have to provide the prefix -> namespace mapping in the context, for
example
my_xpath_expr = xpath.Compile('some-node/xsl:transform')
ctx = xpath.Context.Context(doc, 1, 1, processorNss={'xsl':
'http://www.w3.org/1999/XSL/Transform'})
result_node_set = my_xpath_expr.evaluate(ctx)
--
Uche Ogbuji Principal Consultant
uche.ogbuji@fourthought.com +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python