[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Help with Parameters

Subject: RE: Help with Parameters
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 27 Sep 2006 20:28:07 +0100
jackie radebaugh
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>&#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@xxxxxxx

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.