Subject: [xsl] Variables in XSLT From: "Paul Delange" <Paul.Delange@xxxxxxx> Date: Fri, 27 Jan 2006 10:43:56 -0500 |
Hi All, Sorry for a newbie question, I'm an very experienced programming taking my first crack at an XSLT program. Essentially I need to extract the www.this_is_the_desired_url.com data from the XML below. <VNDR_LOC_SCROL class="R"> <VENDOR_LOC class="R"> <VNDR_LOC IsChanged="Y">1</VNDR_LOC> <VNDR_URL class="R"> <EFFDT IsChanged="Y">2006-01-26</EFFDT> <LINE_NBR IsChanged="Y">1</LINE_NBR> <URL IsChanged="Y">www.this_is_the_desired_url.com</URL> </VNDR_URL> <VNDR_URL class="R"> <EFFDT IsChanged="Y">2006-01-26</EFFDT> <LINE_NBR IsChanged="Y">2</LINE_NBR> <URL IsChanged="Y">www.this_is_an_unwanted_url.com</URL> </VNDR_URL> </VENDOR_LOC> <VENDOR_LOC class="R"> <VNDR_LOC IsChanged="Y">1</VNDR_LOC> <VNDR_URL class="R"> <EFFDT IsChanged="Y">1901-01-01</EFFDT> <LINE_NBR IsChanged="Y">1</LINE_NBR> <URL IsChanged="Y">www.this_is_another_unwanted_url.com</URL> </VNDR_URL> </VENDOR_LOC> </VNDR_LOC_SCROL> The deciding factors in selecting that <URL> tag over the other's are; - It has maximum effective date (<EFFDT> = 2006-01-26) - It's effective date does not exceed the current date. - It is the first url (<LINE_NBR> = 1) on that date. (This should be a simple <xsl:if test="LINE_NBR" = '1'">) With my conventional programming background, I want to define a $maxeffdt variable BEFORE I call the template below and this do some kind of <xsl:if test="EFFDT = $maxeffdt> but I'm not sure this is doable/appropriate in the new XSLT world. My current code looks like this; <xsl:template match="VENDOR_LOC"> <xsl:if test="VNDR_LOC = ../../DEFAULT_LOC"> <--Eliminates non-default locations not shown above <C3><xsl:value-of select="VNDR_LOC" /></C3> <HOMEPAGE><xsl:value-of select="VNDR_URL/URL" /></HOMEPAGE> </xsl:if> </xsl:template> Can someone point me in the right direction with appropriateness/syntax? FYI, I am using a PeopleSoft Application Engine program to transform my data.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Keying over added attribu, Tim Lebo | Thread | Re: [xsl] Variables in XSLT, David Carlisle |
Re: [xsl] Sorting with partial stri, David Carlisle | Date | Re: [xsl] Keying over added attribu, Tim Lebo |
Month |