|
Subject: Re: [xsl] Conditionally compare dates from two XML docs? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 21 Feb 2003 08:32:24 +0000 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Conditionally compare dates f, damianclark | Thread | RE: [xsl] Conditionally compare dat, Michael Kay |
| AW: [xsl] How to Save Transformed X, Zink, Juergen | Date | [xsl] Import stylesheets with xalan, Andrey Guskov |
| Month |