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

Re: Suppress and test

Subject: Re: Suppress and test
From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx>
Date: Mon, 07 Apr 2008 09:38:10 +0100
Re:  Suppress and test
Hi Pankaj,

I'd do this with separate templates, and let the processor do the hard work for you, like so:

<xsl:template match="article/meta/journalcode[.='CEDE']">
	<xsl:apply-templates mode="CEDE"/>
</xsl:template>

<xsl:template match="article/meta/journalcode[.='CIJB']">
	<xsl:apply-templates mode="F-chic-auth-date"/>
</xsl:template>

<xsl:template match="article/meta/journalcode">
	<xsl:element name="journalcode">
		<xsl:attribute name="dummy">
			<xsl:value-of select="string(.)"/>
		</xsl:attribute>
		<xsl:copy-of select="@*"/>
	</xsl:element>
</xsl:template>


The journalcode element will only be copied to the output when it's string value is NOT 'CEDE' or 'CIJB'.
Hope that helped...


Ronan


Pankaj Chaturvedi wrote:
Hi,

I've an element <journalcode>CIJB</journalcode>, which I want to suppress
(make an empty element) in my output while also testing its string value to
apply different modes.

I've defined the following but ending up with result <journalcode
dummy="CIJB"/>CIJB<issn ............... (though getting fair result with
testing). I've tried different way around to get the desired output
(<journalcode dummy="CIJB"/>) but doesn't seems to be working. Can I've any
suggestions in this regard. I think I am doing something wrong with
<xsl:apply-templates> here, but not sure.




<xsl:template match="article/meta/journalcode"> <xsl:element name="journalcode"> <xsl:attribute name="dummy"> <xsl:value-of select="string(.)"/> </xsl:attribute> <xsl:copy-of select="@*"/> </xsl:element> <xsl:if test="string(.)='CEDE'"> <xsl:apply-templates mode="CEDE"/> </xsl:if> <xsl:if test="string(.)='CIJB'"> <xsl:apply-templates mode="F-chic-auth-date"/> </xsl:if> </xsl:template>


Best,


Pankaj Chaturvedi

============================================================================
================


Confidentiality Notice:" This message and any attachment(s) contained here are information that is confidential, proprietary to IDS Infotech Ltd. and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the individual or the entity it is addressed to. If you are not the intended recipient of this message, you are not authorized to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer."




--
Ronan Klyne
Business Collaborator Developer
Tel: +44 01189 028518
ronan.klyne@xxxxxxxxxxx
www.groupbc.com

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.