|
|||||||
| Register | FAQ | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Hi all,
I've used BC 3.1.11 with the plugin "xml tidied with attr. sorted", shown on the left and right side in the file compare window. At the moment I've noticed a stranged behaviour: I've compared two xml files (tortoise svn version on the left and 2nd file on the right) which should be nearly the same. But the differences which where shown were much more than I've expected. The reason was that the xml plugin does not sort the attributes. First I thought this was an effect of the read only file from svn, but I copied the content from the left side to a new file a recompare them. The same effect. What is my mistake? Do I have to do a retrigger of the comparison process? Best regards Michael |
|
#2
|
|||
|
|||
|
Hello,
XML Attributes are not the nodes themselves, but quoted attributes within a node, such as: <photo src="shasta" id="p001" filetype="gif" /> Sorted attributes would sort src, id and filetype, but would not reorder the node <photo> amongst other nodes. Are your files having trouble with sorted attributes or nodes? If you are still running into any issues, please let us know. If you could post some example files, or email them to support@scootersoftware.com with your Support.zip (from the Help menu -> Support; Export), we can take a look at them. Please do not post your Support.zip to the forum, and if you email us, please include a link back to this forum post. Thanks.
__________________
Aaron P Scooter Software |
|
#3
|
|||
|
|||
|
Hi,
am I right that BC3 does not resort the nodes, only the attributes? If it is so, is there a way to preprocess the xml files before I compare them with BC? If there's no way I'll have to develop a small tool to reorder the nodes. I'll post you my example in a few minutes. The first edition of the files will be represent the files in way I get them and they should be compared. The files are nearly equal, but BC3.1.11 shows differences with the plugin "xml with attributes sort". The second edition of the files will be represent the files in way I sort them by hand and compare them via BC3.1.11. BC3 shows that there are no differences. Best regards Michael |
|
#4
|
|||
|
|||
|
Hello,
We received your email and I have sent a response. The issue is that we sort the attributes, not the nodes, with that File Format. In the email is a link to our KB article: http://www.scootersoftware.com/suppo...rnalconversion This details how to create a custom conversion process and how to call it with BC3.
__________________
Aaron P Scooter Software |
|
#5
|
|||
|
|||
|
When I have to sort nodes in an XML document, I write a simple XSLT sheet and use an XSLT parser (like the Saxon.NET Transform.exe program) in the external conversion.
Base the stylesheet on the identity template that copies everything verbatim ... Code:
<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> Code:
<xsl:template match="photo">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates>
<xsl:sort select="@id"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
|
|
#6
|
|||
|
|||
|
Hi,
I've used the following xsl: Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" indent="yes" />
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*">
<!-- <xsl:preserve-space elements="*"/> -->
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates>
<!-- Sort by name -->
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|comment()|processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
@dr_barnowl: Can you rate my xsl? It would be important for me to have a very general xsl and not a specific one which I have to adapt everytime I'll get a new xml. Another problem was that my xsl inserts blank lines, this problem I've corrected by parsing the (transformed) xml and eleminating the blank lines. But I guess that xsl should be possible to do this job. Best regards Michael |
|
#7
|
|||
|
|||
|
Hello,
We've recently added an "XML Sorted and Tidied" file format to our external conversions page based on a general xslt and conversion program. We would be very interested in any feedback: http://www.scootersoftware.com/downl...kb_moreformats
__________________
Aaron P Scooter Software |
|
#8
|
|||
|
|||
|
First of all, let me say that "XML Tidied with Attributes Sorted" is an awesome plug-in.
However, when two nodes have exactly the same attributes, it would be helpful if the nodes would be sorted by alphabetically: http://screencast.com/t/y6oXRCtV5l http://screencast.com/t/xlbSZ6mB This might need to be accomplished in two steps:
Both XML Sorted and XML Sorted and Tidied blow up on my files: http://screencast.com/t/QFOvV05f http://screencast.com/t/NbW8pCHghRg
__________________
BC v3.3.5 build 15075 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ Last edited by Michael Bulgrien; 08-Feb-2011 at 11:07 AM. |
|
#9
|
|||
|
|||
|
Hello Michael,
Thanks for the suggestion. Would you be able to send in this pair of sample files to support@scootersoftware.com ? Please include a link to this forum post for reference.
__________________
Aaron P Scooter Software |
|
#10
|
|||
|
|||
|
I had already sent the file pair several days ago, but got no response. I've resent the files.
__________________
BC v3.3.5 build 15075 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
![]() |
| Thread Tools | |
| Display Modes | |
|
|