xml editor

Products

Features

  EPUB
Supported platforms

Supports Windows 7 & Mac OS X Lion

Ready for XML Editor data server software
W3C Member

attr() as argument in oxy_substring

<oXygen/> general issues.

attr() as argument in oxy_substring

Postby xmlman » Wed Dec 21, 2011 10:00 pm

Can the attr() be used as the value for the text using oxy_substring CSS function? I need to eliminate part of the xlink:href value of my <link> element to create links in Author. The syntax of the value must be maintained due to propriety IETM publishing software. My link element looks like this:

<link xlink:href="IETM://M00033" xmlns:xlink="http://www.w3.org/1999/xlink"><prompt>PROMPT TEXT</prompt></link>

I need to grab the substring "M00033" for file name of the linked to file.

I have tried the following:
link:before {link: oxy_substring(attr(xlink|href),7)".xml";}

and I have tried:

link:before {link: oxy_xpath("substring-after(attr(xlink|href),'IETM://')".xml";}

Neither method using Oxygen CSS custom extension functions is working. Is what I'm trying to do possible?
xmlman
 
Posts: 11
Joined: Wed Oct 12, 2011 7:51 pm

Re: attr() as argument in oxy_substring

Postby Radu » Thu Dec 22, 2011 12:27 pm

Hi Charles,

The main problem is that Oxygen contributes to each Author page with an implicit CSS file which contains this implicit rule:

Code: Select all
*[xlink|href]:before {
    content:url(../images/link.gif);
    link: attr(xlink|href) !important;
}


Because this implicit contributed rule is marked as !important it overrides the property that you have set in your CSS file.

The workaround is to also mark your link property as important like:
Code: Select all
link:before {
   link: oxy_concat(oxy_substring(attr(xlink|href), 7), ".xml") !important;
   content: "LINK";
   text-decoration:underline;
   color:blue;
   display:inline;
}


Of course you also have to declare a namespace mapping at the beginning of your CSS file:

Code: Select all
@namespace xlink url('http://www.w3.org/1999/xlink');


The alternative using XPath should have been like:

Code: Select all
link: oxy_xpath("//*[@xlink:href]/substring-after(@xlink:href,'IETM://')") ".xml" !important;


It does not properly work because when executing the XPath we should also declare mappings for the prefixes currently defined in the CSS files. I added an improvement request for this.
To make this work using the XPath expression for now you can use a more generic construct like:

Code: Select all
link: oxy_xpath("//*[@*:href]/substring-after(@*:href,'IETM://')") ".xml" !important;


Regards,
Radu
Radu Coravu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Radu
 
Posts: 1509
Joined: Fri Jul 09, 2004 5:18 pm

Re: attr() as argument in oxy_substring

Postby Radu » Thu Jan 12, 2012 1:58 pm

Hi,

Oxygen 13.2 which has just been released will try to map prefixes defined in the CSS xpath function by also looking at namespace mappings declared in the CSS file.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Radu
 
Posts: 1509
Joined: Fri Jul 09, 2004 5:18 pm


Return to Other Issues

Who is online

Users browsing this forum: No registered users and 0 guests

cron
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>® XML Editor