This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Comparing two large stylesheets





>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]