Re: Selecting xml: attributes using CSS attr()

George Bina <[email protected]>
Newsgroups gmane.text.tei.general
Message-ID <[email protected]>
I played with the CSS namespace declaration, that also works, bit it 
should be:

@namespace xml "http://www.w3.org/XML/1998/namespace";

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 23/02/17 05:42, George Bina wrote:
> See https://www.w3.org/TR/css3-selectors/#attrnmsp
> It works in oXygen and in Firefox.
>
> test.xml
> ========
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/css" href="test.css"?>
> <TEI xmlns="http://www.tei-c.org/ns/1.0">
>   <teiHeader>
>       <fileDesc>
>          <titleStmt>
>             <title>Title</title>
>          </titleStmt>
>          <publicationStmt>
>             <p>Publication Information</p>
>          </publicationStmt>
>          <sourceDesc>
>             <p>Information about the source</p>
>          </sourceDesc>
>       </fileDesc>
>   </teiHeader>
>   <text>
>       <body>
>          <p>Some text here.</p>
>          <note xml:id="id1">This should work...</note>
>       </body>
>   </text>
> </TEI>
>
>
> test.css
> ========
> @namespace xml url(http://www.w3.org/XML/1998/namespace);
> * {
>     display:block;
> }
> note:before {
>     color:red;
>     content: attr(xml|id);
> }
>
> Best Regards,
> George
> --
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
> On 23/02/17 03:56, John P. McCaskey wrote:
>> Have you seen that work?
>>
>> It’s not working for me in IE-Edge or in Chrome.
>>
>> John
>>
>>
>> On 2/22/2017 5:40 PM, George Bina wrote:
>>> Hi,
>>>
>>>
>>> The namespace should be
>>> in XML
>>> xmlns:xml="http://www.w3.org/XML/1998/namespace"
>>> (note the missing / as the last character)
>>>
>>> in CSS
>>> @namespace xml "http://www.w3.org/XML/1998/namespace";
>>> ...
>>> note:before {
>>>   content: attr(xml|id);
>>> }
>>>
>>> Best Regards,
>>> George
>>> --
>>> George Cristian Bina
>>> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
>>> http://www.oxygenxml.com
>>>
>>> On 23/02/17 00:04, John P. McCaskey wrote:
>>>> Does anyone know how to get CSS’s attr()function to work with
>>>> namespaced
>>>> attributes such as xml:baseand xml:id?
>>>>
>>>> note:before {content: attr(xml:id)}
>>>>
>>>> produces nothing. I tried defining the namespace in CSS (using
>>>>
>>>> @namespace xml "http://www.w3.org/XML/1998/namespace/
>>>>
>>>> ) and in the <html> element (using
>>>>
>>>> xmlns:xml  ="http://www.w3.org/XML/1998/namespace/"
>>>>
>>>> ) and get told
>>>>
>>>> xml namespace prefix mapped to wrong URI.
>>>>
>>>> But I don’t think that’s the main problem, because it doesn’t work if I
>>>> use a different prefix. I tried
>>>>
>>>> attr(xml\\:id)
>>>>
>>>> but that didn’t work either.
>>>>
>>>> Can it be done? Does anyone know the magic formula?
>>>>
>>>> John
>>>>
>>>>
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.