Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Pretty much the same answer as I provided to your last question, modified to match your new XML format:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" indent="yes"/&gt; &lt;xsl:param name="fileName" select="'updates.xml'" /&gt; &lt;xsl:param name="updates" select="document($fileName)" /&gt; &lt;xsl:variable name="updateItems" select="$updates/feed/entry" /&gt; &lt;xsl:template match="@* | node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@* | node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="feed"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@* | node()[not(self::entry)] | entry[not(id = $updateItems/id)]" /&gt; &lt;xsl:apply-templates select="$updateItems" /&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>When run on the first sample XML, with the second one saved as "updates.xml", this produces:</p> <pre><code>&lt;feed&gt; &lt;author&gt; &lt;firstName&gt;f&lt;/firstName&gt; &lt;lastName&gt;l&lt;/lastName&gt; &lt;/author&gt; &lt;date&gt;2011-01-02 &lt;/date&gt; &lt;entry&gt; &lt;id&gt;1&lt;/id&gt; &lt;Name&gt;aaa&lt;/Name&gt; &lt;Content&gt;XXX&lt;/Content&gt; &lt;/entry&gt; &lt;entry&gt; &lt;id&gt;2&lt;/id&gt; &lt;Name&gt;newName&lt;/Name&gt; &lt;Content&gt;newContent&lt;/Content&gt; &lt;/entry&gt; &lt;entry&gt; &lt;id&gt;3&lt;/id&gt; &lt;Name&gt;ccc&lt;/Name&gt; &lt;Content&gt;ZZZ&lt;/Content&gt; &lt;/entry&gt; &lt;/feed&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload