xsl-list
[Top] [All Lists]

Re: [xsl] XPath - accessing nodes with a namespace with no prefix

2009-12-04 18:22:05
Thanks Markus,

(1) You are correct, that was a typo - This was just an example

(2) adlnav is in another namespace, so that is not possible. I apologize for 
not being more clear. The example markup was a dumb-downed version.

(3) It's possible to select a node by using local-name() in a predicate with a 
wild card e.g. //*[local-name()='title']. however, this may give me the wrong 
result. I wasn't sure if there was another way

Thanks again,

Phil

 

On Dec 4, 2009, at 5:36 PM, Markus Flatscher wrote:

Philip,

(1) Which element are you trying to access? If it's the "Content
Package and Manifest Analogy" one, I suspect a typo in your XPath:
instead of "/organizations/organization/title[2]/title" (which doesn't
match anything in the sample input), try
"/organizations/organization/item[2]/title".

(2) Re namespaces: in order for the sample XML to be well-formed, you
need to bind "adlnav" to some namespace.

(3) Re your question about local-name(), I'm afraid I'd need more
information about what you're trying to do.

Markus

On Fri, Dec 4, 2009 at 5:04 PM, Philip Vallone
<philip(_dot_)vallone(_at_)verizon(_dot_)net> wrote:

Hi,

This is a pure xpath question.

Suppose I have a namespace declaration like this:

<organizations version="1.0" xmlns="http://www.imsglobal.org/xsd/imscp_v1p1";>

The namespace does not have a prefix. I want to use local-name() to access 
the nodes but not sure how. For example, how do I access a path like this:

XPATH:

/organizations/organization/title[2]/title

XML:
       <organizations version="1.0" 
xmlns="http://www.imsglobal.org/xsd/imscp_v1p1";>
               <organization>
                       <title>SCORM 2004 4th Edition Manifest Basics Content 
Example 1.0</title>
                       <item>
                               <title>Introduction to Manifests</title>
                               <adlnav:presentation>
                                       <adlnav:navigationInterface>
                                               
<adlnav:hideLMSUI>continue</adlnav:hideLMSUI>
                                               
<adlnav:hideLMSUI>previous</adlnav:hideLMSUI>
                                       </adlnav:navigationInterface>
                               </adlnav:presentation>
                       </item>
                       <item>
                               <title>Content Package and Manifest 
Analogy</title>
                               <adlnav:presentation>
                                       <adlnav:navigationInterface>
                                               
<adlnav:hideLMSUI>continue</adlnav:hideLMSUI>
                                               
<adlnav:hideLMSUI>previous</adlnav:hideLMSUI>
                                       </adlnav:navigationInterface>
                               </adlnav:presentation>
                       </item>
               </organization>
       </organizations>


Thanks,

Phil
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--