Subject: RE: Help with Parameters
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 27 Sep 2006 20:28:07 +0100
|
I can't see what this has to do with parameters.
When you do apply-templates, each node that you select it processed by
exactly one template rule. If something is being processed twice, then
there's a flaw in your logic somewhere.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Jacqueline Radebaugh [mailto:jrad@xxxxxxx]
> Sent: 27 September 2006 20:12
> 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
|