Rolf Kemper wrote:
> Dear ALL,
>
> I have an xml containing an order of elements which is quite big (Mega
> Bytes)
> Example:
> <root>
> <e1 />
> <e5 />
> <e3 />
> <e2 />
> <e5 />
> <e2 />
> <e1 />
> </root>
>
> What I want to do is to look for a ceratin sequence of elements:
> e.g. e5,e2 (e5 must be followed by e2)
> e.g. e5,*,e2 (which left out e3)
>
> In a matching template or foreach I have only the current element in
> scope.
> A variable used in that scope is re-defined in next match. Hence this
> does not help.
> How can this be solved somehow
Doesn't
<xsl:template match="/">
<xsl:if test="root/e5[following-sibling::*[1][self::e2]]">
...
</xsl:if>
</xsl:template>
do the check for the first type of sequence you asked for?
The second would be
<xsl:if test="root/e5[following-sibling::*[1] and
following-sibling::*[2][self::e2]]">...</xsl:if>
Of course instead of an xsl:if check you could use such expressions in
an apply-templates or for-each, depending on what you want to do if you
find a sequence.
--
Martin Honnen --- MVP Data Platform Development
http://msmvps.com/blogs/martin_honnen/