Re: [xsl] merging readings with children

Subject: Re: [xsl] merging readings with children
From: James Cummings <James.Cummings@xxxxxxxxx>
Date: Thu, 29 May 2003 11:47:30 +0100 (BST)
David Carlisle wrote:
>By throwing away all the interior markup  and using normalize-space
>you get a well defined meaning for when two elements are "equal" and
>also get a respectable looking output.
>
>If anyone from the WG is reading this they might like to explain how
>(if:-) the xpath2 deep-equal function would (or wouldn't) help here.
>
>the following modifies things so that the <note> element geths through
>to the output, but whether its notion of equality agrees with your own
>I'm not sure...

I don't think it really does test _equality_  in real-world
xml-as-document cases, since without normalize-space
a single whitespace (of any sort)  in the <app> in between
<rdg>s, or in them, causes two otherwise equal  readings
not to be merged into one.  Yes, I can see that this could mean
they aren't technically identical, but certainly for my purposes
they would be equal. i.e.:
------
 <p id="a2"><body wit="A B C">This is a
<app><rdg wit="A">test</rdg>
 <rdg wit="B"><note>Test</note> testament
 </rdg>
   <rdg wit="C"><note>Test</note> testament     </rdg>
</app> only a test.
</body>
<body wit="D">This is a different body element</body>
  </p>
------
Should output:

<p id="a2">
<body wit="A">This is a test only a test.</body>
<body wit="B C">This is a <note>Test</note> testament only a test.</body>
<body wit="D">This is a different body element</body>
</p>
------

I know B and C are different since B has a newline and C some spaces,
but it still strikes me that this should be possible?

Would another approach be to expand all the <rdg>s in a first
stylesheet, normalizing-space (somehow?), and getting something
like:
------
<p id="a2">
<body wit="A">This is a test only a test.</body>
<body wit="B C">This is a <note>Test</note> testament only a test.</body>
<body wit="C">This is a <note>Test</note> testament only a test.</body>
<body wit="D">This is a different body element</body>
</p>
------

Before passing through another stylesheet which does the
comparison/merge?  Or am I barking (up the wrong tree)?

-James

-- 
Dr James Cummings, James.Cummings@xxxxxxxxx, http://www.uea.ac.uk/~q503
Cursus Project, School of Music, University of East Anglia,
Norwich, Norfolk, NR4 7TJ, UK  Tel:(01603)593-595



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


Current Thread