RE: [xsl] Comparing two large stylesheets

Subject: RE: [xsl] Comparing two large stylesheets
From: "Bryan Rasmussen" <bry@xxxxxxxxxx>
Date: Wed, 27 Mar 2002 18:03:50 +0100


>Hi list,

>I am looking for way of comparing two large stylesheets.  In this instance
>they are both very similar, but the templates are in a different order and
a
>few of the element names they match are slightly different.  For example,
>file1 ,may have:

>xsl:for-each select="foo/bar/quantity"

>and file2 have:

>xsl:for-each select="for/bar/qty"

><xsl:template match="*"> //on file1
>  <xsl:copy>
>     <xsl:apply-templates select="document($file2)//*[name()=.]"/>
>  </xsl:copy>
></xsl:template>

it seems to me you need mainly to match templates, right? how about you copy
the node of a template into a parameter, then compare it with what you got
in $file2

something like:
(I prefer using the temp prefix for the xsl namespace if I'm matching
against xsl)
<temp:template match="xsl:template">
<temp:param name="match" select="@match"/>
<temp:param name="templatContent"><xsl:copy-of select="."/></xsl:param>
<temp:apply-templates select="$doc//xsl:template[@match=$match]">
<temp:with-param name="templatContent" select="$templatContent"/>
</temp:apply-templates>
</temp:template>
obviously that doesn't do the whole thing but that way you can build a
matcher, for example with
 <temp:if test="contains($doc//xsl:template/@match,$match)">
or so on



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread