[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
AW: [xsl] XPathAPI: How to associate namespaces
Subject: AW: [xsl] XPathAPI: How to associate namespaces From: "Torsten Schlabach" <tschlabach@xxxxxxx> Date: Tue, 6 May 2003 19:42:04 +0200 |
Sorry, the Report versus report was just a spelling mistake in my mail. I have read the XPathAPI JavaDoc; the issue is not that I don't know how to call it but it does not behave the way I'd expect it to. Torsten -----Ursprüngliche Nachricht----- Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von me@xxxxxxxxxxxx Gesendet: Dienstag, 6. Mai 2003 18:17 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Betreff: Re: [xsl] XPathAPI: How to associate namespaces > Dear list, > > I found the recent posting attached, but the thread > ended there. This is > about Xalan-J 2.x, so I am not too sure if it belongs > here, but I'll try. > > Q: I have a document with the root element being in a > default namespace: > > <?xml version="1.0" encoding="UTF-8"?> > <Report xmlns="http://abc.com/abc/abc";> > <Type>memo</Type> > <Type>rep</Type> > <Link name="xyz">123</Link> > </Report> > > I would like to extract just the Link from that > document trying to use > > XPathAPI.selectNodeList(myDoc,"/report/link") I don't know anything about XPathAPI, but by just looking at the two items you posted you are using the wrong case. Meaning "/report/link" is not the same as "/Report/Link" - just as Torsten is not the same as torsten (perhaps you have been spoiled :) > > will return an empty result set. > > Using > > XPathAPI.selectNodeList(myDoc,"/abc:report/abc:link") > > will result in a transformer exception telling me that > the namespace abc > needs to be assiciated somewhere. > > Where can I do that? Inside the XPath expression? I > read the spec; it look > to me as if XPointer has a syntax for that while XPath > hasn't. But I could > not > find any method to call in order to do this either. google says: selectNodeList public static NodeList selectNodeList( Node contextNode, java.lang.String str, Node namespaceNode) throws TransformerException Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the namespaceNode. Parameters: contextNode - The node to start searching from.str - A valid XPath string.namespaceNode - The node from which prefixes in the XPath will be resolved to namespaces.Returns: A NodeIterator, should never be null.Throws: TransformerException - _/ _/_/ _/_/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ http://treebeard.sourceforge.net http://ashpool.sourceforge.net XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XPathAPI: How to associat, me | Thread | [xsl] MSXML 4.0 SP2 crashes when co, gutman |
Re: [xsl] Newline problems, David Carlisle | Date | [xsl] XSLT editor(open source), Márcio Fernando Kell |
Month |
Keywords