Yes, thank you keshlam. This is the solution that David Bertoni suggested (in the FAQ). It works and it is good.
-Deio
 
-------------- Original message --------------
From: [EMAIL PROTECTED]

Or, much better because it's semantically correct rather than looking only at syntax: bind a prefix to the namespace that code is actually in ("http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#") and use that prefix in the XPath.

A <code> element in one namespace means something completely different from <code> in another namespace. Learn to use namespaces properly.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
-- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://www.ovff.org/pegasus/songs/threes-rev-11.h tml)
Inactive hide details for Robert Houben <[EMAIL PROTECTED]>Robert Houben <[EMAIL PROTECTED]>


          Robert Houben <[EMAIL PROTECTED]>

          02/08/2008 06:42 PM


To


cc

"xalan-j-users@xml.apache.org" <xalan-j-users@xml.apache.org>

Subject

RE: Xalan error when using xpath-default-namespace attribute

Try

*[local-name()="code"]


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent:
Friday, February 08, 2008 3:35 PM
To:
[EMAIL PROTECTED]
Cc:
xalan-j-users@xml.apache.org
Subject:
Re: Xalan error when using xpath-default-namespace attribute

Ah, thank y ou Kes hlam.

In that case, let me revert to my source problem; the problem which I was hoping to solve with xsl:xpath-default-namespace attribute :-)

I have an XML (really an OWL) document which has this element at the top:

<rdf:RDF xmlns="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#"
xml:base="
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#"
xmlns :prote ge="
http://protege.stanford.edu/plugins/owl/protege#"
xmlns:owl="
http://www.w3.org/2002/07/owl#"
xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="
http://www.w3.org/2000/01/rdf-schema#">
Inside the document are elements like this:

<owl:Class rdf:ID="Benzo_a_pyrene-7_8-diol_9_10-Epoxide">
<rdfs:label>Benzo(a)pyrene-7,8-diol 9,10-Epoxide</rdfs:label>
<code>C196</code>
<rdfs:subClassOf rdf:resource="#DNA_Adduct_Forming_Agent"/>
<rdfs:subClassOf rdf:resource="#Intercalating_Agent"/>
........

</owl:Class>


Using Xpath inside of Xalan, I am able to access the nodes that are prefixed with a namespace (such as rdfs:subClassOf or rdf:resource). But I am unable to access the <code> element's contents because it has no namespace prefix. For example,

"owl:Class/code" does not work.

How do I formulate an Xpath _expression_ that accesses the <code> element?

-Deio

-------------- Original message --------------
From: [EMAIL PROTECTED]

Xalan is an XSLT 1.0 processor. xsl:xpath-default-namespace is not a 1.0 directive.

Reply via email to