Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 11th, 2004, 05:21 PM
Registered User
Join Date: Aug 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default attribute namespace prefix

hi all,

I have a question concerning XPath and the use of namespace prefix to target attributes.

Consider the following XML excerpt:

<?xml version="1.0" encoding="UTF-8"?>
<object xmlns="urn:foo:ob" xmlns:it="urn:foo:it" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<item param="value1" it:param="value2"/>

How can I target the param attribute (of the urn:foo:ob NS) by means of an XPath 1.0 and XPath 2.0 expression? Note that I am not interested in the param attribute in the urn:foo:it NS.

As far as I know, XPath 1.0 does not support namespace prefixes to address attribute nodes. Can this be solved in another way? Does XPath 2.0 support the use of prefixes to target attributes?

many thanks in advance
kind regards

Reply With Quote
  #2 (permalink)  
Old August 12th, 2004, 06:01 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Attribute names must be prefixed if you want them in a namespace so you don't need to worry about the overall default namespace. You will need to set up a dummy prefix in your XSLT if you wish to search on elements though.
If your prefix were to be "myNS" then the path would be:




Joe (MVP - xml)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove namespace prefix from XmlBean ratzko BOOK: Professional Java Development with the Spring Framework 0 August 10th, 2008 01:23 PM
Adding Prefix and Namespace to XML Lerxt XSLT 6 November 8th, 2007 03:14 PM
Prefix Data bundersuk Access VBA 2 December 26th, 2006 06:10 PM
How a additional prefix in a namespace comes? diang BOOK: ASP.NET Website Programming Problem-Design-Solution 0 July 13th, 2006 10:40 PM
change namespace leaving prefix unchanged lantoli XSLT 3 June 26th, 2006 07:31 AM

All times are GMT -4. The time now is 06:39 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.