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

RE: Generic Select again

Subject: RE: Generic Select again
From: "Oleg Tkachenko" <olegt@xxxxxxxxxxxxx>
Date: Mon, 6 Aug 2001 22:47:46 +0200
generic select
Hello Sriharsha !

> My XML looks something like this
> 
> <Books>
> <Book id = "1">
>      <TITLE> XML </Title>
Huh, rather strange xml - it's not well-formed, do you mean <TITLE> XML </TITLE> ?

>      <Author> ABC </Author>
>      <Desc> wonderful </Description>
? The same again.

>      <ISBN> 15151161 </ISBN>
> </Book>

> Now I need a generic template wherein I can specify the output to only 
> contain Title or TITLE and Author or TITLE, AUTHOR Description or TITLE, 
> AUTHOR, Description, ISBN. Put in another way, if I can somehow say  dont 
> include ISBN or DONT include ISBN and desc.
> Then finally I want the same thing to apply to the entire data.

What about the following not too generic template:

<xsl:template match="Book">
	<xsl:param name="output-title"/>
	<xsl:param name="output-author"/>
	<xsl:param name="output-desc"/>
	<xsl:param name="output-isbn"/>
	<xsl:if test="$output-title"><xsl:apply-templates select="Title"/></xsl:if>
	<xsl:if test="$output-author"><xsl:apply-templates select="Author"/></xsl:if>
	<xsl:if test="$output-desc"><xsl:apply-templates select="Desc"/></xsl:if>
	<xsl:if test="$output-isbn"><xsl:apply-templates select="ISBN"/></xsl:if>
</xsl:template>

Then you can use it this way to output Title and Author only:

<xsl:apply-templates select="Book[@id='1']">
	<xsl:with-param name="output-title" select="true()"/>
	<xsl:with-param name="output-author" select="true()"/>
</xsl:apply-templates>

---
Oleg Tkachenko,
Multiconn International 


 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.