xquerydoc icon indicating copy to clipboard operation
xquerydoc copied to clipboard

provide xml + css format

Open xquery opened this issue 13 years ago • 1 comments

investigate how far we can style the raw xqdoc output with css

xquery avatar Feb 21 '12 07:02 xquery

I know, this issue is six years old, but for the sake of completeness:

How to add style to XML lines out the basics and Declaring namespaces: the @namespace rule provides further information regarding namespaces.

I am not aware of current CSS capabilities, but it may pose an unresolvable issue, to get the contents of attributes without any further XSLT or XQuery processing.

The info from a construct like:

<xqdoc:namespace prefix="fcx" uri="http://www.functx.com"/>

would need to be made available programmatically.

EDIT: I just checked and found out, that it is possible to reference attribute values for display:

xqdoc|namespace::before {
	content: attr(prefix);
	padding-right:0.5rem;
}
xqdoc|namespace::after {
	content: attr(uri);
}

But this is very primitive and a hack, since the content: attr(x) construct can only go ::before or ::after a displayed item.

EDIT2: It would be better to use attributes only for meta about an element (like in <xqdoc:import type="library">) not to use attributes for any content type and re-spec the <xqdoc:namespace> element to something like:

<xqdoc:namespaces>
  <xqdoc:namespace>
    <xqdoc:prefix>xqdoc</xqdoc:prefix>
    <xqdoc:iri>http://www.xqdoc.org/1.0</xqdoc:iri>
  </xqdoc:namespace>
</xqdoc:namespaces>

EDIT3: Upon further investigation, it looks like using CSS on the XML without substantially changing the XML structure does not seem feasible. The main reason is, that rendering values contained in attributes is very limited:

  1. They can only be displayed ::before and ::after another element.
  2. This means, they can not be styled as list items (adding bullets, etc.)
  3. This also means, that such items can not be displayed as table like data.
  4. Adding content like "Name:" ::before the function name works only, if the <xqdoc:comment> is missing or if it would come after the function name. Current order is:
   <xqdoc:function arity="1">
      <xqdoc:comment>
        <xqdoc:description>Description follows...
  
  @param    $item   the item of interest
  @return   a sequence of items
      </xqdoc:comment>
      <xqdoc:name>ns1:debug</xqdoc:name>
      <xqdoc:annotations>
      [...]

Ideally, the <xqdoc:name> would come before the <xqdoc:comment> element.

An update to the spec may also take the existence of @xml:space and @xml:lang into consideration. Maybe xs:ID and xs:IDREF could be utilized as well for <xqdoc:invoked>? (I did not really analyze the latter).

bmix avatar Nov 13 '18 10:11 bmix