This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Background color change not working




Hello,

I was hoping to get some help with an issue I'm having with xsl:attribute-set.
I am trying to set up a generic attribute that I can use to change the
background color based on a test of an existing attribute (chg).  When chg =
anything but 'U' or 'u' then I want the background color to change to lavender.

When I set the coding below, I do not get any background change.  But if I set
the <font with the style="background: lavender"> directly in the stylesheet that
works.

I tried moving the xsl:attribute-set to the parent stylesheet and that didn't
help either.
Can anyone give me some guidance as to what I am possibly doing incorrect.

I was basing my XSLT coding below on the example from the XSL Programmer's
Reference  (1st edition) (pg 166).

Thanks,

Betty Risher

******************************************************************************************************
Sample XSLT coding

Parent Stylesheet:  AMM.XSL

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
     <xsl:output method="html" indent="yes"/>
     <!--xsl:output method="html" encoding="iso-8859-1"/-->
<xsl:template match="/">
     <html>
          <head>
               <h1>Aircraft Maintenance Manual     </h1>
          </head>
          <body>
               <xsl:apply-templates/>
          </body>
     </html>
</xsl:template>

<xsl:template match="amm">
     <font style="font-family: Helvetica">
     <xsl:apply-templates/>
     </font>
</xsl:template>

<xsl:template match="st">
</xsl:template>

     other templates called being out

<!--Prclist1 elements -->
<!-- Prclist1, prcitem1, prcitem1/preitem/title, prcitem1/prcitem/para  elements
 -->
<xsl:include href="./styles/prclst1.xsl"/>         (calls out the sub-stylesheet
 that contains the <xsl:attribute that
                                     I'm having problems with)

         other templates called being out

</xsl:stylesheet>


Stylesheet:  PRCLST1.XSL
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
     <xsl:output method="html" indent="yes"/>
     <!--xsl:output method="html" encoding="iso-8859-1"/-->

<xsl:attribute-set name="changecolor">
     <xsl:attribute name="style">background-color: lavender</xsl:attribute>
</xsl:attribute-set>

<!-- Prclist1, prcitem1, prcitem1/preitem/title, prcitem1/prcitem/para  elements
 -->
     <xsl:template match="prclist1">
          <xsl:apply-templates select="prcitem1"/>
     </xsl:template>

     <xsl:template match="prcitem1">
          <xsl:apply-templates/>
     </xsl:template>

     <xsl:template match="prcitem1/effect">
          <h5 style="margin-left: 1em">(**Effectivity: For A/C <xsl:value-of
select="@effvect"/>)     </h5>
     </xsl:template>

     <xsl:template match="prcitem1/prcitem/title">
          <h5>
               <xsl:choose>
                    <xsl:when test="@chg">
                         <xsl:choose>
                              <xsl:when test="@chg = 'U'">
                                   <xsl:value-of
select="../../@lbl"/>&#032;<nbsp/> &#032;<nbsp/>
                                   <xsl:apply-templates/>
                              </xsl:when>
                              <xsl:when test="@chg = 'u'">
                                   <xsl:value-of
select="../../@lbl"/>&#032;<nbsp/> &#032;<nbsp/>
                                   <xsl:apply-templates/>
                              </xsl:when>
                              <xsl:otherwise>
                                   <font xsl:use-attribute-set="changecolor">
                                   <!-- font style="background-color: lavender"
  ** this works **-->
                                         <xsl:value-of
select="../../@lbl"/>&#032;<nbsp/> &#032;<nbsp/>
                                          <xsl:apply-templates/>
                                   </font>
                              </xsl:otherwise>
                         </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise>
                         <xsl:value-of select="../../@lbl"/>&#032;<nbsp/>
&#032;<nbsp/>
                         <xsl:apply-templates/>
                    </xsl:otherwise>
               </xsl:choose>
          </h5>
     </xsl:template>

AMM.XML   sample of the XML being converted

<?xml:stylesheet type="text/xsl" href="./amm.xsl"?>
<!DOCTYPE amm SYSTEM "./amm07.dtd">
<!--DOCTYPE amm SYSTEM "./ammfrg.dtd"-->
<amm>
     <st>07</st>
     <chapter confltr=" " chapnbr="07" chg="U" effvect="001999" id="T07"
mfrid="EN07">
          <effect effvect="001999" efftext="001999"/>
          <title chg="r" effvect="001999">LIFTING </title>
          <st>07-00</st>
          <section chapnbr="07" sectnbr="00" chg="U" id="T07-00" mfrid="EN0700">
               <effect effvect="" efftext=""/>
               <title>LIFTING AND SHORING - GENERAL</title>
               <st>07-00-00</st>
               <subject chapnbr="07" sectnbr="00" subjnbr="00" chg="U"
id="T07-00-00" mfrid="EN070000">
                    <effect effvect="" efftext=""/>
                    <title>LIFTING AND SHORING - GENERAL</title>
                    <st>07-00-00-00</st>
                    <pgblk chapnbr="07" sectnbr="00" subjnbr="00" pgblknbr="00"
confltr=" " chg="U" effvect="001999" id="T07-00-00-00" mfrid="EN0700000000">
                         <effect effvect="001999" efftext="001999"/>
                         <title effvect="001999">LIFTING AND SHORING - GENERAL -
 DESCRIPTION AND OPERATION</title>
                         <prclist1>
                              <prcitem1 lbl="1.">
                                   <prcitem>
                                         <title effvect="001999"
chg="r">General</title>
                                         <para effvect="001999">This chapter
provides information relative to the lifting and shoring of the aircraft.</para>
                                         <para effvect="001999" chg="r">It is
divided as follows:</para>
                                         <unlist>
                                              <unlitem>
                                                   <para effvect="001999"
chg="r">
                                                        <refint reftype="DIRECT"
 refid="T07-10-00-00" source="JMIS">07-10-00/P. Block 001</refint>
JACKING</para>
                                              </unlitem>
                                              <unlitem>
                                                   <para effvect="001999"
chg="N">
                                                        <refint reftype="DIRECT"
 refid="T07-20-00-02" source="JMIS">07-20-00/P. Block 201</refint>
SHORING</para>
                                              </unlitem>
                                         </unlist>
                                   </prcitem>
                              </prcitem1>
                         </prclist1>
                    </pgblk>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]