[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A use-case for xsl:merge?

Subject: Re: A use-case for xsl:merge?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 16 Feb 2019 09:54:44 -0000
Re:  A use-case for xsl:merge?
Am 15.02.2019 um 23:53 schrieb John Dziurlaj john@xxxxxxxxxxxxxxxx:
>
> This is very helpful! I've tested it and it seems to work well, with the
> exception of CDATA. The output does not include the CDATA for <text>, which
> should be <text>This is some text</text>. I put this above
> <xsl:apply-templates select="." mode="merge-attributes"> and it seems to
> work:
> <xsl:value-of select="text()" />


I think I would prefer to delegate that to a added template with a 
different condition:

 B B B  <xsl:template match="*[not(*)]" mode="merge-children">
 B B B B B B B  <xsl:param name="prototype"/>
 B B B B B B B  <xsl:copy-of
 B B B B B B B B B B B B  select="if (node()) then node() else $prototype/node()"/>
 B B B  </xsl:template>


> I guess I was fooled by the name of xsl:merge, it seems to be for merging
> sequences rather than content within sequences.

It can merge "content" but the main obstacle with your task to be seemed 
to be the lack of order of the possible child elements, if you group 
elements on node-name() as I have done then you don't need them ordered, 
for xsl:merge to work you would need to have them ordered or would need 
to first order them, see 
https://www.w3.org/TR/xslt-30/#merge-terminology wich defines


A*merge input sequence*is an arbitrarysequence 
<https://www.w3.org/TR/xpath-datamodel-30/#dt-sequence>^DM30 of items 
which is already sorted according to themerge key specification 
<https://www.w3.org/TR/xslt-30/#dt-merge-key-specification>for the 
correspondingmerge source definition 
<https://www.w3.org/TR/xslt-30/#dt-merge-source-definition>.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.