Mark Fletcher wrote:
>
> Thanks for the tip about using the dot as the second parameter of the
> document() function! That solved my relative path problem. FWIW, I
> can't get document() to work if there is a hash mark in the url. So I
> use this instead:
>
> document((substring-before(@conref,'#'),.)
>
> Not sure if this is as documented or not. But it's certainly an easy
> enough workaround.
At least in the XXE V3.2 (not yet released) I'm using:
* document("foo.dita#bar",.) works fine (but there must be an element
having ID "bar" in "foo.dita").
* document("foo.dita#bar/gee",.) cannot work for the reasons I've
explained in my previous email.
>
> I have another question about your xpath interpretation. I'm getting two
> different results with two similar implementations.
>
> This xpath returns the result of the expression to the left of the pipe:
>
> xpath("ancestor::reltable|document(@href,.)//shortdesc")
>
> But this xpath never returns the result of the expression to the left of
> the pipe:
>
>
> xpath("ancestor::reltable|document(substring-before(@href,'#'),.)//*...@id
> =substring-after(current()/@href,'#')]/shortdesc")
>
> In fact, the left-hand expression returns false even if I do this:
>
>
> xpath(".|document(substring-before(@href,'#'),.)//*...@id=substring-after(
> current()/@href,'#')]/shortdesc")
>
>
> Is there something about my right-hand expression that's causing this?
> I've tried grouping in parentheses to make the logical distinction
> clearer, but it doesn't help.
>
I've tested a rule similar to this one:
topicref:before {
content: "*" xpath("ancestor::reltable|document(@href,.)//shortdesc");
}
And it works as expected:
* If the topicref is contained in a relcell which is contained in a
reltable, I get no generated content from the xpath() part because a
reltable and its descendants almost never contains text. (Remember how
nodesets are converted to strings.)
* If the topicref is not contained in a descendant of a reltable, this
CSS rule pulls the text of the shortdesc (if "document(@href,.)" exists
and contains at least one shortdesc).
* Note that I've added "*" to generated content because in XXE,
'content:"";' means suppress generated content.