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

Please help (XSLT)

Subject: Please help (XSLT)
From: Cheun N Chong <cnc99r@xxxxxxxxxxxxxxx>
Date: Thu, 1 Jun 2000 16:29:25 +0100 (BST)
rss expire xsl
Dear all,

	I am confused about XSLT again. I have the following XML codes:

	<TICKETS>
     	   <TICKET>
		<FEATURES>
		   <NUMBER>1</NUMBER>
		   <EXPIRE>2 May 2000</EXPIRE>
		</FEATURES>
		<CONDITION>valid</CONDITION>
	   </TICKET>
	
	   <TICKET>
		<FEATURES>
		   <NUMBER>2</NUMBER>
		   <EXPIRE>10 May 2000</EXPIRE>
		</FEATURES>
		<CONDITION>valid</CONDITION>
	   </TICKET>
	  
	   <TICKET>
		<FEATURES>
		   <NUMBER>5</NUMBER>
		   <EXPIRE>5 May 2000</EXPIRE>
		</FEATURES>
		<CONDITION>valid</CONDITION>
	   </TICKET>
	</TICKETS>
	
	Assume the ticket thing in the XML is lottery tickes.
	I have created an XSL file in order to:
	1. read in the today's date and compare to the <EXPIRE>
	   and set the <CONDITION>
	2. compare the <NUMBER> with the input winning number
	   and set the <CONDITION>
	and transform it into a new XML document, for example out.xml.
	(I am using LotusXSL and XML4J from alphaWorks of IBM)

	I have created the following XSL codes:
	
	...
	<xsl:param name="expire" />
	<xsl:param name="win" />

	<xsl:template name="readExp">
		<xsl:variable
name="expireDay" select="format-number(number(substring-before($expire,'
')),'00')" />
		<xsl:variable
name="expireMonth" select="document('')//fo:month[@name=substring-before(substring-after($expire,'
'),' ')]/@num" />
		<xsl:variable
name="expireYear" select="substring-after(substring-after($expire,' '),'
')" />
		<xsl:value-of
select="number(concat($expireYear,$expireMonth,$expireDay))" />
	</xsl:template>

	<xsl:template match="TICKETS">
		<xsl:element name="TICKETS">
			<xsl:apply-templates select="TICKET" />
		</xsl:element>
	</xsl:template>

	<xsl:template match="FEATURES">
		<xsl:element name="FEATURES">
			<xsl:apply-templates select="NUMBER" />
			<xsl:apply-templates select="EXPIRE" />
		</xsl:element>
	</xsl:template>

	<xsl:template match="CONDITION">
		...
	</xsl:template>

	At the CONDITION, when I tried this:

	<xsl:value-of select="//EXPIRE"	 />

	It only print out the first TICKET's EXPIRE value which is "2 May 
2000". Please help me. Even a small hint is much appreciated. Thousand
thanks.

Best regards,
Cheun Ngen CHONG



 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.