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

RE: Design problem - print header information only if

Subject: RE: Design problem - print header information only if some element exists in the detail.
From: "Zarella Rendon" <zarella@xxxxxxxxxxxxx>
Date: Fri, 26 Apr 2002 11:25:37 -0500
email prints header only
Hi Ming-tzung,

Try this:

<xsl:template match="Header">
<xsl:if test="contains(Detail, 'sometext')">
<xsl:apply-templates/>
</xsl:if>
</xsl:template>

Where 'sometext' is the text match for your satisfaction criteria.

Zarella

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Dung,
> Ming-tzung
> Sent: Wednesday, April 24, 2002 12:37 PM
> To: XSLT List (E-mail)
> Subject:  Design problem - print header information only if some
> element exists in the detail.
>
>
> Hi,
>    I have an input XML source as the following:
> ....
> <Header>
> ....
> <!-- could have multiple detail information. -->
> <Detail>..<Detail>
> </Header>
>     I need to output the content of the Header ONLY IF certain information
> exists in the detail. (Let us called this as the satisfied
> Detail). Besides,
> each satisfied Detail needed to print out after the Header. The design
> forces also includes that the testing condition may grow complex in the
> future.
> I guess that I have two ways in solving this; however, none of
> the solution
> I come up with is not a good solution.
> <1>
>   Pass the document to one XSL for filtering out the 'unsatisfied' Detail.
> Then pass the filtered XML to the XSLT again for  output.
>   ==>Disadvantage - the performance.
> <2>
>    Use <xsl:for-each > to select the satisfied Detail node.
>    ==>Disadvantage: If the condition grows complex, I am not sure whether
> the select attribute within the <xsl:for-each> can fulfill the needs. In
> addition, If there are multiple detail, how I can print the Detail element
> once only within the <xsl:for-each> body? (The only solution for
> this I can
> see is have two <xsl:for-each>. The first one is check there is any Detail
> satisfied. If yes, print the header information. Then the second print out
> the detail. )
>
>   Thanks in advance!!
>
>
> Ming-tzung Dung
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.