• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with namespace:: axis with SAXON processor

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have problem with following XSL, while doing SAXON processing.

<xsl:variable name="uri" select="string(namespace::*[name() = $prefix])"/>

SAXON, not able to process the above line and giving exception:
net.sf.saxon.trans.XPathException: Axis step namespace::namespace() cannot be used here: the context item is undefined.

I found out, namespace:: axis has been deprecated.

Please help me in , how can we write the above line without using namespace:: axis.

Thanks in Advance!!
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite independent of whether namespace axis be deprecated or not, the xpath itself is not clear and that's the problem. I guess you want to find what kind of uri associated with a certain prefix? The question itself is not very generic to xml recommendation as the prefix is something allowed at the caprice of those authoring the document.

But, if you really want to take a look of it, you can still do something like this.

I would not be too enthusiatic with that, but it serves the intention of knowing what can be done and what cannot.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's pretty clear to me that your XSLT processor does support the namespace axis, otherwise it would just say it doesn't support it. But it doesn't say that. It says this instead:

the context item is undefined


So if it were me, I would be putting in some code which defines the context item as my first step.
 
g tsuji
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed if insist on using namespace axis, now that I see better what you mean, you can do this.

That would show the same results as the first post. It is important to note that the same prefix can well be associated with different uri.
 
reply
    Bookmark Topic Watch Topic
  • New Topic