Subject: RE: [xsl] XSL comparing nodesets by name only From: "Ludwig, Michael" <Michael.Ludwig@xxxxxxxxxxxx> Date: Mon, 15 Nov 2010 17:42:53 +0100 |
> -----Original Message----- > From: Michael Kay [mailto:mike@xxxxxxxxxxxx] > I don't see any alternative to coding it as a nested loop > > <xsl:variable name="matches"> > <xsl:for-each select="$me1"> > <xsl:for-each select="$me2"> > <xsl:if test="name($me1) = name($me2)">yes</xsl:if> > </ > </ > </ Maybe two keys: D:\Temp :: more /t2 me.xml <data:root xmlns:data="da.ta"> <data:me1> <a></a> <b/> </data:me1> <data:me2> <a>value</a> <dd></dd> </data:me2> </data:root> D:\Temp :: more /t2 me.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:data="da.ta" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="ISO-8859-1" indent="yes"/> <xsl:key name="me1" match="data:me1/*" use="name()"/> <xsl:key name="me2" match="data:me2/*" use="name()"/> <xsl:template match="/*"> <data:out> <xsl:for-each select="data:me1/*"> <xsl:if test="key( 'me2', name() )">yes</xsl:if> </xsl:for-each> </data:out> </xsl:template> </xsl:stylesheet> D:\Temp :: msxsl me.xml me.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <data:out xmlns:data="da.ta">yes</data:out> -- Michael Ludwig
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL comparing nodesets by, Brandon Ibach | Thread | Re: [xsl] XSL comparing nodesets by, Lars Huttar |
Re: [xsl] XSL comparing nodesets by, Brandon Ibach | Date | Re: [xsl] Sorting using more than v, Susan Bodnik |
Month |