Hi Mike,
It seems that the para element is an exception for using that mode because it also has
the feature of passing along a role attribute as a class attribute. If the para in
question has a role attribute (of any value) and the $para.propagates.style is set to
1 (the default), then your template will work. The mode is not used otherwise. I
think this is a bit of inconsistent behavior that should be looked at more closely by
the developers. Could you please file a bug report on the SourceForge site to get
this straightened out?
The entry element has the same story, since it also has an $entry.propagates.style
attribute.
It did work for match="section" when I tried it, adding the width attribute to the
section's div element in the output.
BTW, this line in your template does nothing useful.
<xsl:param name="width" select="local-name(.)"/>
It creates a template parameter but never uses it. Setting width to a value of
"section" is not a valid value. I think you modeled it on the class param where a
value of "section" does make sense as a default.
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: "mike 675" <[email protected]>
To: <[email protected]>
Sent: Wednesday, September 21, 2011 1:28 AM
Subject: Re: re: [docbook-apps] Accessibility: adding scope attribute to HTML
output
I can't seem to get this working consistently.
I would expect the following customization to change all <para> elements to
<p width="50px"> in the HTML output.
But it has no effect.
<xsl:template match="para" mode="class.attribute">
<xsl:param name="width" select="local-name(.)"/>
<xsl:attribute name="width">50px</xsl:attribute>
</xsl:template>
Neither does using "section" as the match.
Nor informaltable/tgroup/thead/row/entry, which is one of the elements I
want to change.
However, if I match for "itemizedlist", 50px turns up in the <ul> HTML
element.
Is it OK to use a simple xpath, such as "section" for matching elements?
Robert Nagle wrote:
1. Yes, all you have to do is add it to your customization layer. You
will need to replace caption/para with an xpath statement that
corresponds to the table element(s) you want to customize. (and
remember if you are not using the vanilla docbook xsl but the
namespace xsl (i.e., docbook-ns), you will need to preface everything
with d: in the xpath statement. So caption/para would be
d:caption/d:para ).
2. For my example at
http://lists.oasis-open.org/archives/docbook-apps/201108/msg00091.html
, my source code would say either:
<caption> <para> Hello </para> </caption>
Or
<caption> <para role="50x"> Hello </para> <caption>
Your output after you applied the transformation would be (I think)
<div class="caption">
<p width="50px">Hello </p></div>
I gave two examples. In one example I made the assumption that you
would hardcode the values of width in the XSL customization layer --
so you wouldn't need to put it in the xml source code. In the other
example, I assumed that you would grab the values from the role
attribute in the <para> element in source.
However, if the value of the scope attribute is always going to be
"col", I don't see any reason why you couldn't hard code it in the XSL
customization layer. others may disagree about this.
--
---------- Forwarded message ----------
From: mike 675 <[email protected]>
To: [email protected]
Date: Mon, 19 Sep 2011 01:58:03 -0700 (PDT)
Subject: [docbook-apps] Accessibility: adding scope attribute to HTML
output
To meet accessibility requirements, we need to add the scope attribute to
the
HTML output for our tables.
Our tables are marked up in DocBook XML, CALS style.
Every <th> needs to be <th scope="col">
The first <td> in a <tr> needs to be <td scope="row">
Any ideas on where to start on this.
I guess I need to cusomize the html/table.xsl stylesheet.
Robert Nagle
6121 Winsome Ln #56C, Houston TX 77057-5581
(H) 713 893 3424/ (W) 832-251-7522 Carbon Neutral Since Jan 2010
http://www.robertnagle.info
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
View this message in context:
http://old.nabble.com/Accessibility%3A-adding-scope-attribute-to-HTML-output-tp32493408p32503723.html
Sent from the docbook apps mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]