[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: cknell@xxxxxxxxxx
Date: Wed, 27 Sep 2006 15:58:19 -0400
RE:  Help with Parameters
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

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-2011 All Rights Reserved.