Subject: RE: Help with Parameters
From: cknell@xxxxxxxxxx
Date: Wed, 27 Sep 2006 15:58:19 -0400
|
When you look at the source document, how can you tell which <desc> elements you want to process with the "leader" mode template and which you want to process with the modeless template?
--
Charles Knell
cknell@xxxxxxxxxx - email
-----Original Message-----
From: Jacqueline Radebaugh <jrad@xxxxxxx>
Sent: Wed, 27 Sep 2006 15:12:06 -0400
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Help with Parameters
Dear All:
I am trying to implement a parameter into my style sheet, but am having some problems.
I need to output the <desc> element in two different ways.
I first introduce the parameter with the following code:
<xsl:apply-templates select="parent::example/desc" mode="leader">
<xsl:with-param name="special_desc">yes</xsl:with-param>
</xsl:apply-templates>
The template for <desc> is:
<xsl:template match="example/desc" mode="leader">
<xsl:param name="special_desc"/>
<xsl:choose>
<xsl:when test="$special_desc='yes'">
<fo:wrapper font-style="italic" font-weight="normal">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</fo:wrapper>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
This works, however, I need another template for <desc> to cover all other occurrences of <desc> in the file that do not fall under the parameter. I therefore have the following template:
<xsl:template match="desc">
<fo:block margin-left="8em" font-style="italic" font-weight="normal">
<xsl:apply-templates select="@* | *[contains(@type, $my_version) or string-length(@type)=0] | text()"/>
</fo:block>
</xsl:template>
Unfortunately, the <desc> text that matches the parameter is being output twice: once in the pattern outlined in the parameter and once in the pattern outlined in the generic <desc> template. How can I get the <desc> text matching the parameter to output only once (as outlined by the parameter) and still allow all other cases of the <desc> text to output as outlined by the generic "desc" template?
Thank you very much for any help that you may provide me. I sincerely appreciate it!
Best wishes,
Jackie Radebaugh
Library of Congress
Network Development & MARC Standards Office
Washington, DC
USA
Phone: +1-202-707-1153
FAX: +1-202-707-0115
E-Mail: jrad@xxxxxxx
|