|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Conditionally compare dates from two XML docs?
Hi Damian,
> How do I access the 'date1' from the original source tree, now that
> I'm processing the external document 'AddNews.xml'? i.e, change
> context from one document to another?
Store it in a variable before you change the context:
<xsl:variable name="date1" select="date1" />
<xsl:for-each select="document('AddNews.xml')/newsindex/entry">
<xsl:if test="number($date1) = number(date2)">
<xsl:value-of select="headline"/>
</xsl:if>
</xsl:for-each>
Or, if that's the totality of your <xsl:for-each>, you could use a
predicate and the current() function instead, and do:
<xsl:for-each select="document('AddNews.xml')/newsindex/entry
[date2 = current()/date1]">
<xsl:value-of select="headline" />
</xsl:for-each>
In an XPath predicate, the current() function gets you the current
node -- the node that you're processing outside the XPath.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








