OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Formatting variables in a Template


Hello All!

I've got some bad code thats not working as needed.  I am trying to define variables within a template and have a conditional statement adjust those variables to be used as attributes in a fo:block. 

Below is the XSLT code, It's intended to take a <important> tag and format it based upon the root tag having a conformance attribute of 535.6

Its sets the values for notice.color, notice.width and notice.text.color but it then always ignores the <xsl:if test="/*/@conformance='535.6'"> statement.

 

Any suggestions?

XSLT code:

<xsl:template match="important">

<xsl:variable name="id">

<xsl:call-template name="object.id"/>

</xsl:variable>

<xsl:variable name="notice.width" select="100"/>

<xsl:variable name="notice.color">#ffffff</xsl:variable>

<xsl:variable name="notice.text.color">#000000</xsl:variable>

<xsl:if test="/*/@conformance='535.6'">

<xsl:attribute name="notice.color">#007dc0</xsl:attribute>

<xsl:variable name="notice.text.color">#ffffff</xsl:variable>

<xsl:if test="/*/@role='Safety'">

<!-- Set parameters for 535.6 notices NOT in safety chapter -->

<xsl:variable name="notice.width" select="50"/>

</xsl:if>

</xsl:if>

<fo:block font-family="{$body.font.family}" padding-top="5pt" padding-bottom="0pt" padding-left="5pt" padding-right="5pt" width="{$notice.width}%" id="{$id}">

<fo:table keep-together.within-column="always" width="{$notice.width}%" padding-bottom="10pt">

<fo:table-body start-indent="0pt" end-indent="0pt">

<fo:table-row>

<fo:table-cell padding-bottom="4pt">

<fo:block color="{$notice.text.color}" background-color="{$notice.color}" vertical-align="bottom" height="20pt" padding="1pt" text-align="center" font-weight="bold" font-style="italic">

<xsl:call-template name="gentext">

<!--NEED NOTICE HERE -->

<!--<xsl:with-param name="key" select="'NOTICE'"/>-->

<xsl:with-param name="key" select="'IMPORTANT'"/>

</xsl:call-template>

</fo:block>

</fo:table-cell>

</fo:table-row>

</fo:table-body>

</fo:table>

</fo:block>

<!-- Actual Note contents -->

<fo:block font-family="{$body.font.family}" padding-top="0pt" padding-bottom="10pt" padding-left="5pt" padding-right="5pt">

<fo:table keep-together.within-column="always" keep-with-previous.within-column="always">

<fo:table-body start-indent="0pt" end-indent="0pt">

<fo:table-row>

<fo:table-cell>

<fo:block xsl:use-attribute-sets="note.properties">

<xsl:apply-templates/>

</fo:block>

</fo:table-cell>

</fo:table-row>

</fo:table-body>

</fo:table>

</fo:block>

</xsl:template>

 

XML Code:

 

<chapter conformance="535.6">

<title>Safety</title>

<sect1>

<title role="strong">General Safety Precautions</title>

<para>para>

<important>

<para role="strong">some important text<para>

</important>

 

Thanks,

David White



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]