xsl-list
[Top] [All Lists]

Re: [xsl] selecting specific elements from a second file

2016-12-17 09:27:14
On 17.12.2016 16:19, Mark Wilson mark(_at_)knihtisk(_dot_)org wrote:
I want to select elements from the second file to add to the first file
when their @pofis-number match (in this instance 2966 has a match, 2967
does not.

Well, which XSLT processor do you use, which XSLT version?

With XSLT 2.0 you could define a key

<xsl:key name="flaws" match="Flaws" use="@pofis-number"/>

and then write a template

<xsl:template match="Stamp">
  <xsl:copy>
<xsl:apply-templates select="@*, node(), key('flaws', @pofis-number, doc('file2.xml'))/node()"/>
  </xsl:copy>
</xsl:template>

together with identity transformation template (or XSLT 3.0 xsl:node on-no-match="shallow-copy").
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>