Dear Hussein,
thank you for the alternatives. You took me on right way.
content:xpath("count(//ns:Comment[count(following-sibling::ns:Comment[attrib
ute::Id = current()/@Id])> 0])+1")
works fine and generates the correct number inside the reference.
Thanks
Stefan
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Hussein Shafie
Gesendet: Freitag, 3. September 2010 18:43
An: Stefan Klatt
Cc: '[email protected]'
Betreff: Re: [XXE] XInclude: Referencing the content of pseudo-elements?
On 09/03/2010 03:21 PM, Stefan Klatt wrote:
>
> Something that also would be very helpful for our "Knowledge engineers":
>
> In our medical guidelines we have paragraphs with the character of
comments.
>
>
> We give them markers (C1, C2, C3...), that starts with "1" under each new
> Top element.
>
> Top > Comment:before {content:"C"
> xpath("count(preceding-sibling::ns:Comment)+1") " ";}
>
> When we create references (xinclude) to these Comments, it would be very
> intuitive to see these generated markers inside the references.
>
> Is there any way to address the "before" pseudo-element to reach this goal
> or do you have another solution?
>
There is no difference between styling an element and styling the
reference to an element. Therefore something like
---
Top > Comment:before {content:"C"
xpath("count(preceding-sibling::ns:Comment)+1") " ";}
---
would work fine on included Comment elements.
The problem is that the above rule will not give the C1, C2, C3, etc,
numbering you expect. For example, an original Comment element marked as
C27 in document A could have its reference in document B marked as C1.
Supposing that each Comment element has a distinct ID, *may* *be* there
is a way to write a very, very, elaborate xpath() expression which could
give you the rank of the original Comment element. *May* *be* something
involving:
document(property({http://www.xmlmind.com/xmleditor/namespace/property}sourc
eURL))//comme...@id
= current()/@id]
document() and current() are standard XSLT 1 functions. property() is an
extension function. See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpathextfunc.html
Otherwise, the only way to solve your problem would be to write in Java
a custom stylesheet extension.
See http://www.xmlmind.com/xmleditor/_distrib/doc/dev/styleext.html
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support