Format the audience attribute

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Boreas
Posts: 86
Joined: Wed Feb 09, 2011 10:43 pm

Format the audience attribute

Post by Boreas »

We have a document that includes a whole bunch of parameters, some of which are for internal use only.
We use the audience attribute to filter out some information that we do not want to disclose to users. It works fine, but I was asked to format the audience attribute so that in the internal document, the information stands out.

in the commons.xsl file, I added this:

Code: Select all


    <xsl:template match="*[contains(@class, ' topic/audience ')]">
<fo:bloc xsl:use-attribute-sets="audience">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:bloc>
</xsl:template>
And in the commons-attr.xsl I added this:

Code: Select all


    <xsl:attribute-set name="audience">
<xsl:attribute name="color">#FFC0CB</xsl:attribute>
</xsl:attribute-set>
but when I generate the pdf, the information in the audience attribute, is not formatted in pink. (yes it is just for testing, won't actually use pink)

here is how we use the attribute

Code: Select all


      <section audience="internal">Access rights are customised with the following parameters:
<ul>
<li>
<parmname >HiddenUserReadAccessCriteria</parmname>
</li>
<li>
<parmname>HiddenUserWriteAccessCriteria</parmname>
</li>
<li>
<parmname>HiddenObserverReadAccessCriteria</parmname>
</li>
<li>
<parmname>HiddenObserverWriteAccessCriteria</parmname>
</li>
</ul>
</section>
So I can't figure out why it is not working.....does anyone have an idea?

kind regards
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: Format the audience attribute

Post by Radu »

Hi,

Usually profiling attributes set on DITA content are not passed through to the resulting post processed DITA content.
To pass these profiling attributes further on you need to define them in the DITAVAL filter file as "pass-through":

topic10569.html#p32967

About what you are doing:

Code: Select all

 <xsl:template match="*[contains(@class, ' topic/audience ')]">
<fo:bloc xsl:use-attribute-sets="audience">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:bloc>
</xsl:template>
I will assume by "bloc" you wanted to write "block".
There are still problems, you are removing in a way the default processing which takes place on the element which contains the @audience attribute. Instead of "<xsl:apply-templates/>" you could try to use "<xsl:next-match/>" to match the base XSLT template which takes care of the element. Also you seem to assume that the matched element is a block-like element but maybe people can set the @audience attribute also on inline elements.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply