XSL and QNames

Pieter Vandepitte

Usenet Archive
Joined
Jan 7, 2004
Messages
4
Reaction score
0
Hi,
i have an xml document like this:

<?xml version="1.0"?>
<qname:element id="blabla" xmlns:qname="http://myblabla.com"> <qname:child>My text</qname:child> </qname:element>

[remark: i'm using QNames in my xml document]

Suppose i want to get the attribute 'id' from qname:element and the value of the qname:child node, how should i do this with xsl?

i thought it would work just like other stylesheets, without taking into account the qname, but it didn't work :(

Anyone a solution?

w.Kind regards
Pieter
 

Patrick TJ McPhee

Usenet Archive
Joined
Apr 2, 2000
Messages
269
Reaction score
0
% <?xml version="1.0"?>
% <qname:element id="blabla" xmlns:qname="http://myblabla.com"> % <qname:child>My text</qname:child> % </qname:element>

% [remark: i'm using QNames in my xml document]

A QName is a combination of a name space and an element name. In your example, `qname' is a name space prefix while qname:child is a QName.

% Suppose i want to get the attribute 'id' from qname:element and the % value of the qname:child node, how should i do this with xsl?

You need to define a name space prefix in the stylesheet. For instance



You can, of course, define the name space prefix at a higher level.

It's worth mentioning that you must use a name space prefix in the stylesheet, even if you use a default name space in your xml document.
 

Pieter Vandepitte

Usenet Archive
Joined
Jan 7, 2004
Messages
4
Reaction score
0
thanx!! i was forgotten an xsl document IS an xml document, in which you can use an xmlns 'name space prefix' ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top