[xsl] using xsl:if to test the value of a node

Subject: [xsl] using xsl:if to test the value of a node
From: Kevin Friend <kevin@xxxxxxxxxxxx>
Date: Thu, 5 Dec 2002 16:48:37 +1100
I am very new to XSL, so I hope you will excuse the basic questions!

I am using MS ie6 for my XSL experiments and I need to do some data sorting.

I have an xml document that contains a number of "ARTICLE" nodes, each
article node contains a "CODE" node.

I need to only transform ARTICLE nodes where the CODE node value starts with
a "J" (or a "B").

My data looks like...

<ARTICLE_LIST>
	<ARTICLE Test="OK">
		<CODE>J107_SYD-LAX-JFK.102</CODE>
		<PACKAGE>PK x 15</PACKAGE>
		<LOADPORT>SYD QFCL</LOADPORT>
		<ORDERED>6300</ORDERED>
		<DELIVERED>0</DELIVERED>
		<USED>0</USED>
		<ONHAND>0</ONHAND>
		<VIEWFILE>TRUE</VIEWFILE>
	</ARTICLE>

I am trying the following...

<xsl:template match="/">
	<xsl:copy>
	<xsl:apply-templates/>
	</xsl:copy>
</xsl:template>
<xsl:template match="ARTICLE_LIST">
	<xsl:copy>
	<xsl:apply-templates>
		<xsl:sort select="CODE"/>
		<xsl:sort select="LOADPORT"/>
	</xsl:apply-templates>
	</xsl:copy>
</xsl:template>
<xsl:template match="ARTICLE">
	<xsl:if test="child::CODE[. $lt$ 'K' and . $gte$ 'J']">
	<xsl:copy>
		<xsl:apply-templates/>
	</xsl:copy>
	</xsl:if>
</xsl:template>
.....

and other combinations of anything else I can find....

any help would be greatly appreciated!




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


Current Thread