Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Please help (XSLT)

From: Cheun N Chong <cnc99r@--------------->
To:
Date: 6/1/2000 5:29:00 PM
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


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent