Peter,
Wow!!!!
Such a small change. But it works!!! Such a small change. This moved it from
9 hours plus to 9 seconds.
And I had a bug to fix. I forgot the [1] so it was inserting too much stuff.
<xsl:variable name="item_number" select="preceding::LEXDomain[1]"/>
Thank you Peter!!!
Jim Albright
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:variable name="LN" select="document('LN-PT-converted2.html')"/>
<xsl:key name="insert" match="html/body/p" use="@domain"/>
<xsl:template match="Comments[parent::LEXSense[@LanguageCode='pt']]">
<xsl:variable name="item_number" select="preceding::LEXDomain[1]"/>
<xsl:element name="Comments">
<xsl:apply-templates select="$LN/key('insert', $item_number)"/>
</xsl:element>
</xsl:template>
<xsl:template match="span[@class='LNgrk']"/>
<xsl:template match="span[@class='LNdfe']"/>
<xsl:template match="span[@class='LNgle']"/>
<xsl:template match="span[@class='LNill']"/>
<!-- identify transform -->
<xsl:template match="@*|*|processing-instruction()|comment()">
<xsl:copy>
<xsl:apply-templates
select="*|@*|text()|processing-instruction()|comment()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
-----Original Message-----
From: Jim Albright jim_albright(_at_)wycliffe(_dot_)org
[mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Sent: Monday, January 14, 2019 6:50 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] inserting data from second file using key and document
Peter
That is what I am trying to do but something is wrong with my attempt. Any
clues?
<xsl:variable name="LN" select="document('LN-PT-converted2.html')"/>
<xsl:key name="insert" match="$LN/html/body/p" use="@domain"/>
<xsl:template match="Comments[parent::LEXSense[@LanguageCode='pt']]">
<xsl:variable name="item_number" select="preceding::LEXDomain"/>
<xsl:element name="Comments">
<xsl:apply-templates select="key('insert',
$item_number)"/>
</xsl:element>
</xsl:template>
-----Original Message-----
From: Pieter Masereeuw pieter(_at_)masereeuw(_dot_)nl
[mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Sent: Monday, January 14, 2019 12:46 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] inserting data from second file using key and document
Hi Jim,
I have once been struggling too to solve this. The way I do it now is by
placing the key() function after a variable that references a node in the
external document. E.g.:
<xsl:variable name="doc" select="doc('some-uri')"/> ...
<xsl:apply-templates select="$doc/key(...)"/>
Pieter
--~----------------------------------------------------------------
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
--~--