How do use an attribute with a namespace using oxy_xpath?

Oxygen general issues.
xmlman
Posts: 13
Joined: Wed Oct 12, 2011 7:51 pm

How do use an attribute with a namespace using oxy_xpath?

Post by xmlman »

In a CSS, I want to insert the value of an attribute of a parent element. The attribute has a namespace. I have the namespace declared.

@namespace xlink "http://www.w3.org/1999/xlink";

I have tried this:

warning>trim\.para>link>prompt { content: oxy_xpath('parent::link/@xlink:href'); }

That produces the following error message in Author:

System ID: C:\Program Files\Oxygen XML Editor 13\frameworks\MIL-STD-2361C\css\Production.css
Severity: error
Description: [CSS]:XPath failed: XPath failed due to: Prefix xlink has not been declared

I have also tried:

warning>trim\.para>link>prompt { content: oxy_xpath('parent::link/@xlink|href'); }

which renders nothing.

Is there way to make this work?
xmlman
Posts: 13
Joined: Wed Oct 12, 2011 7:51 pm

Re: How do use an attribute with a namespace using oxy_xpath?

Post by xmlman »

You can ignore this posting. I figured this out looking at some other code you sent me. I see that by using an asterisk (*) in place of the namespace name the error is not generated.

I implemented the following:

warning>trim\.para>link>prompt {

content: oxy_xpath('parent::link/@*:href')
}

This renders as I wanted.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: How do use an attribute with a namespace using oxy_xpath?

Post by Radu »

Hi Charles,

Yes, the asterisk is a workaround for a problem in 13.1.
Oxygen 13.2 will also work with your first approach.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply