xsl-list
[Top] [All Lists]

[xsl] Help with Parameters

2006-09-27 12:13:18
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>&#160;&#160;&#160;&#160;</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(_at_)loc(_dot_)gov



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>