Andreas Kemkes wrote:
> 
> In the meantime, this issue goes a while back. Then, I
> had difficulties with the following CSS:
> 
> graphic {
>   display: block;
>   content: paragraph(content(image(attr(src), -400,
> -100, smooth), xpath("alt")));
> }
> 
> No alt text would display.  I finally figured it out. 
> Instead of having
> 
> @namespace "<a namespace>";
> 
> and the above CSS entry, I needed to use 
> 
> @namespace ans "<a namespace>";
> 
> and replace xpath("alt") with xpath("ans:alt").
> 
> It took me a while and I'm still not clear on why the
> former would not work.

XPath ignores the concept of default namespace. That's part of the standard.

CSS3 does not. That is, the default namespace applies to CSS selectors,
but only to CSS selectors.

For maximum efficiency, please add both:
---
@namespace "<a namespace>"; [1]
@namespace ans "<a namespace>"; [2]
---
[1] accelerates CSS selector matching when you use rules such as
"graphic {...}".
[2] is required by xpath().




> Taking it a step further the xpath expression
> xpath("ans:f...@id=current()/@ref]") only seems to
> work with that exact syntax (i.e.,
> xpath("ans:f...@ans:id=current()/@ans:ref]") did not).
>  What am I missing here?

Generally attributes such as "id" and "ref" do not make use of
namespaces. That is, there are no attributes called "ans:id" and
"ans:ref" in your document. Your attributes really are "id" and "ref"
(with no namespace).
Therefore "ans:f...@ans:id=current()/@ans:ref]" simply cannot work.



> Also, I would like to tag on a question:
> 
> Is it possible to style the result of an xpath
> expression for display?  In my experiments, it only
> seems to pick up the text and not apply any styling
> from the CSS file.  Is this expected behavior?  I
> would like to display the above content identical to
> the <ans:faq> element in the document.  Can this be
> achieved?

Yes, you style the result of xpath() by making it part of a paragraph()
(which can be styled).

---
graphic {
  display: block;
  content:
    paragraph(content(image(attr(src), -400, -100, smooth),
                      xpath("ans:alt")),
              font-style, italic);
}
---

or simply:
---
graphic {
  display: block;
  content:
    paragraph(content(image(attr(src), -400, -100, smooth),
                      xpath("ans:alt")));
  font-style: italic;
}
---

Elaborate example (see attachment):
---
div.paragraph3 {
    content: division(content(paragraph(content(icon(delete), " ",
                                                icon(replace), " ",
                                                icon(insert-before)," ",
                                                icon(insert)),
                                        border-width, 1,
                                        border-style, solid),
                              paragraph(content(icon(insert-after), " ",
                                                icon(convert), " ",
                                                icon(plus-box), " ",
                                                icon(minus-box)),
                                        color, blue),
                              paragraph(content(icon(plus), " ",
                                                icon(minus), " ",
                                                icon(pop-nw), " ",
                                                icon(pop-ne), " ",
                                                icon(pop-sw), " ",
                                                icon(pop-se)),
                                        border-width, 1,
                                        border-style, solid),
                              paragraph(content(icon(check-on), " ",
                                                icon(check-off), " ",
                                                icon(radio-on), " ",
                                                icon(radio-off)),
                                        color, blue)));
    color: green;
}
---
If, in the above example, you replace icon(XXX) by xpath(YYY), it will
work fine too.



> And finally, I would like to see if the following
> proposed enhancement would make sense and be feasible.
>  Currently, when the content: property is used with an
> element, none of the element's children are processed
> with the style sheet.  

That's normal. This element has *replaced* content. This content
replaces the whole subtree.



> Is it possible to have a
> pseudo-function (e.g., apply-css) that would indicate
> to process them?  I encountered some cases, in which
> it was hard or impossible to do what I had in mind.  A
> better XML design could have helped in most of those
> cases, but change is not always an option.

I'm sorry but we do not intend to make CSS as powerful as XSL through
proprietary extensions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elaborate_example.png
Type: image/png
Size: 1168 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20060802/d9ccb67a/attachment.png
 

Reply via email to