[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Variables in XSLT
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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|