XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Mapping complex document with ... (8)
-> + Sorting in XSLT (2)
-> + xsl date time adding... (16)
-> - Flat XML to nested XML convers... (1)
-> + parser for parsing XSL file (2)
-> - q on group function (1)
-> + compare 2 date value using xsl (2)
-> - Remove namespaces from SOAP pa... (1)
-> + Numeric string not displaying ... (3)
-> + where is the old HTM to XSL wi... (2)
-> + XSLT variable path (2)
-> + Sort by lookup values & styles... (2)
-> + Hi without hard code filed na... (2)
-> + XSLT output does not work (2)
-> + How can I do this javascript i... (2)
-> + Paging with XSL and passing UR... (2)
-> + XPath Condition Query (3)
-> + Xalan Multiple XML Output Over... (3)
-> + Inserting Line Break (2)
-> + Get Value from non-standard xm... (2)
-- Previous [541-560] [561-580] [581-600] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
ramesh mSubject: XSLT - find line numbers of differences
Author: ramesh m
Date: 22 May 2008 06:01 AM
Hi,

I need a help in xslt. I'm finding the difference between two xml files. First I thought to merge those two xml files in a single file and do the comparison between those parts. I find it using :

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/" xmlns:xmlplease="http://www.xmlplease.com/xslt" xmlns:functx="http://www.functx.com" xmlns:exsl="http://exslt.org/functions"
xmlns:set="http://exslt.org/sets"
extension-element-prefixes="exsl"
exclude-result-prefixes="set" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xsl:output method="text" />
<xsl:function name="functx:sequence-deep-equal" as="xs:boolean" xmlns:functx="http://www.functx.com" >
<xsl:param name="seq1" as="item()*"/>
<xsl:param name="seq2" as="item()*"/>

<xsl:sequence select="
every $i in 1 to max((count($seq1),count($seq2)))
satisfies deep-equal($seq1[$i],$seq2[$i])
"/>

</xsl:function>
<xsl:function name="functx:index-of-node" as="xs:integer*"
xmlns:functx="http://www.functx.com" >
<xsl:param name="nodes" as="node()*"/>
<xsl:param name="nodeToFind" as="node()"/>

<xsl:sequence select="
for $seq in (1 to count($nodes))
return $seq[$nodes[$seq] is $nodeToFind]
"/>

</xsl:function>
<xsl:variable name="doc1" select="files/file1/file" />
<xsl:variable name="doc2" select="files/file2/file" />
<xsl:template match="/">

<xsl:if test="functx:sequence-deep-equal($doc1/., $doc2/.)">
Hi
</xsl:if>

<xsl:if test="not(functx:sequence-deep-equal($doc1/., $doc2/.))">
bye
</xsl:if>

I need help in getting the line number, where the actual difference has occured. If the errors have occurred many times, then I need the line numbers of those errors.

thanks
rummy

Posttop
Minollo I.Subject: XSLT - find line numbers of differences
Author: Minollo I.
Date: 22 May 2008 08:34 PM
General XSLT questions are better asked on XSLT discussion lists, like the one at http://www.mulberrytech.com/xsl/xsl-list/index.html

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.