I cannot figure out how to suppress the default attribute shape="rect" in an xhtml output document when using xsl:copy-of.
Sample XML:
<div class="table">
<p class="table-caption"><span class="table-label">Table 7.2</span> Foo<a class="tabfn-ref"
href="#s9781483390086.i825" id="s9781483390086.i808" shape="rect"><sup>a</sup></a> in
Pricing</p>
<img alt="Table 11" class="table-image" src="10.4135_9781483390086-table11.jpg"/>
<table>
<tgroup cols="3">
<colspec align="left" colname="1" colnum="1"/>
<colspec align="left" colname="2" colnum="2"/>
<colspec align="left" colname="3" colnum="3"/>
<thead>
<row rowsep="1">
<entry align="left">
<p/>
</entry>
<entry align="left">
<p>N</p>
</entry>
<entry align="left">
<p>%</p>
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<p>Foo<a class="tabfn-ref" href="#s9781483390086.i826"
id="s9781483390086.i809" shape="rect"><sup>b</sup></a></p>
<p>1–12</p>
<p>13–24</p>
<p>25–36</p>
<p>37–48</p>
<p>49–60</p>
<p>61–72</p>
<p>73–84</p>
<p>85–96</p>
<p>More than 96</p>
</entry>
</row>
<row>
<entry>
<p>Bar<a class="tabfn-ref" href="#s9781483390086.i827"
id="s9781483390086.i810" shape="rect"><sup>c</sup></a></p>
<p>1–20%</p>
<p>21–40%</p>
<p>41–60%</p>
<p>61–80%</p>
<p>More than 80%</p>
</entry>
</row>
</tbody>
</tgroup>
</table>
<div class="table-notes" id="s9781483390086.i825a">
<p class="table-note" id="s9781483390086.i825b"><span class="label-fn"><a class="tabfn-ref"
href="#s9781483390086.i808" id="s9781483390086.i825" shape="rect"
><sup>a</sup></a></span> Foo</p>
<p class="table-note" id="s9781483390086.i825c"><span class="label-fn"><a class="tabfn-ref"
href="#s9781483390086.i809" id="s9781483390086.i826" shape="rect"
><sup>b</sup></a></span> Bar</p>
<p class="table-note" id="s9781483390086.i825d"><span class="label-fn"><a class="tabfn-ref"
href="#s9781483390086.i810" id="s9781483390086.i827" shape="rect"
><sup>c</sup></a></span> Too</p>
</div>
Sample XSLT:
<?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" xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xs xhtml" xmlns="http://www.w3.org/1999/xhtml"
version="2.0">
<xsl:output method="xhtml" indent="yes"/>
<!-- Suppress default shape attribute -->
<xsl:template match="*/#shape"/>
<!-- Identity template -->
<xsl:template match="node()|#*">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:template>
<xsl:template priority="1" match="//div[#class='table']//p[#class='table-caption']"/>
<xsl:template match="table">
<xsl:element name="table">
<xsl:attribute name="hidden" select="'hidden'"/>
<xsl:element name="caption">
<xsl:copy-of select="preceding-sibling::p[#class='table-caption'] | *[not(preceding::a/#shape)]"/>
</xsl:element>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
I need to suppress the shape="rect" from the output. As you can see, it is suppressed from the output for all anchors, except for the one using xsl:copy-of. How can I specify suppression in the line:
<xsl:copy-of select="preceding-sibling::p[#class='table-caption'] | *[not(preceding::a/#shape)]"/>
This is obviously not working.
Output:
<div class="table">
<img alt="Table 11" class="table-image" src="10.4135_9781483390086-table11.jpg"/>
<table xmlns="http://www.w3.org/1999/xhtml" hidden="hidden">
<caption>
<p xmlns="" class="table-caption">
<span class="table-label">Table 7.2</span> Foo <a class="tabfn-ref"
href="#s9781483390086.i825" id="s9781483390086.i808" shape="rect">
<sup>a</sup>
</a> in Pricing </p>
</caption>
<tgroup xmlns="" cols="3">
<colspec align="left" colname="1" colnum="1"/>
<colspec align="left" colname="2" colnum="2"/>
<colspec align="left" colname="3" colnum="3"/>
<thead>
<row rowsep="1">
<entry align="left">
<p/>
</entry>
<entry align="left">
<p>N</p>
</entry>
<entry align="left">
<p>%</p>
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<p>Foo <a class="tabfn-ref" href="#s9781483390086.i826" id="s9781483390086.i809">
<sup>b</sup>
</a>
</p>
<p>1–12</p>
<p>13–24</p>
<p>25–36</p>
<p>37–48</p>
<p>49–60</p>
<p>61–72</p>
<p>73–84</p>
<p>85–96</p>
<p>More than 96</p>
</entry>
</row>
<row>
<entry>
<p>Bar <a class="tabfn-ref" href="#s9781483390086.i827" id="s9781483390086.i810">
<sup>c</sup>
</a>
</p>
<p>1–20%</p>
<p>21–40%</p>
<p>41–60%</p>
<p>61–80%</p>
<p>More than 80%</p>
</entry>
</row>
</tbody>
</tgroup>
</table>
<div class="table-notes" id="s9781483390086.i825a">
<p class="table-note" id="s9781483390086.i825b">
<span class="label-fn">
<a class="tabfn-ref" href="#s9781483390086.i808" id="s9781483390086.i825">
<sup>a</sup>
</a>
</span> Foo </p>
<p class="table-note" id="s9781483390086.i825c">
<span class="label-fn">
<a class="tabfn-ref" href="#s9781483390086.i809" id="s9781483390086.i826">
<sup>b</sup>
</a>
</span> Bar </p>
<p class="table-note" id="s9781483390086.i825d">
<span class="label-fn">
<a class="tabfn-ref" href="#s9781483390086.i810" id="s9781483390086.i827">
<sup>c</sup>
</a>
</span> Too </p>
</div>
</div>
In the first a class="tabfn-ref" the shape attribute is retained (due to copy-of). I need this to be suppressed.
You do not have the ability to exclude attributes or nodes when using xsl:copy-of. It performs a deep copy of the selected node.
Since you are already using the identity transformation with an empty template to suppress the #shape attribute and already have an empty template matching //div[#class='table']//p[#class='table-caption'], the easiest thing to do would be to change the <xsl:copy-of> to <xsl:apply-templates> with a mode and define a template in that mode to copy and apply-templates.
<?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"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xs xhtml" xmlns="http://www.w3.org/1999/xhtml"
version="2.0">
<xsl:output method="xhtml" indent="yes"/>
<!-- Suppress default shape attribute -->
<xsl:template match="*/#shape"/>
<!-- Identity template -->
<xsl:template match="node()|#*">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:template>
<xsl:template priority="1"
match="//div[#class='table']//p[#class='table-caption']"/>
<xsl:template match="//div[#class='table']//p[#class='table-caption']"
mode="caption">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="table">
<table hidden="hidden">
<caption>
<xsl:apply-templates
select="preceding-sibling::p[#class='table-caption']
| *[not(preceding::a/#shape)]" mode="caption"/>
</caption>
<xsl:apply-templates/>
</table>
</xsl:template>
</xsl:stylesheet>
Related
My XML input:
<result>
<objects name="wf1">
<object>
<qname>wf</qname>
<object_name>Nr 1</object_name>
<person_name>Anton</person_name>
</object>
<object>
<qname>wf</qname>
<object_name>Nr 2</object_name>
<person_name>Ben</person_name>
</object>
</objects>
<objects name="wf2">
<object>
<qname>wf</qname>
<object_name>Nr 2</object_name>
<person_name>Chris</person_name>
</object>
<object>
<qname>wf</qname>
<object_name>Nr 3</object_name>
<person_name>Dirk</person_name>
</object>
</objects>
</result>
Things to note
There are two blocks with information: wf1 and wf2
Both have an object with object_name = 'Nr 2'
All objects have qname = 'wf'
My XSLT:
<xsl:template match="/">
<xsl:call-template name="output_html" />
</xsl:template>
<xsl:template name="output_html">
<html>
<body >
<table>
<tr>
<th>Object name</th>
<th>Person name</th>
</tr>
<xsl:apply-templates select="result/objects/object[qname='wf']" />
</table>
</body>
</html>
</xsl:template>
<xsl:template match="object[*]">
<tr align="center" valign="top">
<td><xsl:value-of select="object_name"/></td>
<td><xsl:value-of select="person_name"/></td>
</tr>
</xsl:template>
Output:
Object name
Person name
Nr 1
Anton
Nr 2
Ben
Nr 2
Chris
Nr 3
Dirk
My wish:
I would like to see unique object names. If an object with a certain name appears in both wf1 and wf2 then only the one from wf2 should be shown.
So the desired output would be:
Object name
Person name
Nr 1
Anton
Nr 2
Chris
Nr 3
Dirk
The information "Ben" gets lost. That is fine.
Does anybody have ideas about how to achieve that in XSLT 1.0?
In XSLT 1.0, it would be best to adapt the Muenchian method to the current problem:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="obj-by-name" match="object" use="object_name" />
<xsl:template match="/result">
<html>
<body >
<table>
<!-- header -->
<tr>
<th>Object name</th>
<th>Person name</th>
</tr>
<!-- for each distinct object_name -->
<xsl:for-each select="objects/object[count(. | key('obj-by-name', object_name)[1]) = 1]">
<tr>
<td>
<xsl:value-of select="object_name"/>
</td>
<td>
<!-- sort the group with wf2 on top -->
<xsl:for-each select="key('obj-by-name', object_name)">
<xsl:sort select="number(../#name='wf2')" data-type="number" order="descending"/>
<xsl:if test="position()=1">
<xsl:value-of select="person_name"/>
</xsl:if>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
If <objects name="wf2"> will always come after <objects name="wf1">, then you can shorten this to:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="obj-by-name" match="object" use="object_name" />
<xsl:template match="/result">
<html>
<body >
<table>
<!-- header -->
<tr>
<th>Object name</th>
<th>Person name</th>
</tr>
<!-- for each distinct object_name -->
<xsl:for-each select="objects/object[count(. | key('obj-by-name', object_name)[1]) = 1]">
<tr>
<td>
<xsl:value-of select="object_name"/>
</td>
<td>
<xsl:value-of select="key('obj-by-name', object_name)[last()]/person_name"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Source-XML:
<data>
<item>
<values>
<element1>
<language>EN</language>
<text>text</text>
</element1>
<element2>
<language>DE</language>
<text>Text</text>
</element2>
</values>
</item>
<item>
<values>
<element5>
<language>EN</language>
<text>description</text>
</element5>
<element6>
<language>DE</language>
<text>Beschreibung</text>
</element6>
</values>
</item> </data>
I want to get all the elements in language 'EN'. First I have a loop, where I saved the elment names in a variable. In the next step I want to get only the elements in language "EN". I need in the result of this step only the element-name and text which have the language 'EN' to build a table.
I tried this:
<xsl:param name="element" select="'element1'"/>
<xsl:template match="/">
<xsl:if test="data/item/values[local-name()=$element]/language[text()='EN']">
</xsl:if>
</xsl:template>
And the output XSLT should be something like:
<table id="123">
<tgroup cols="2">
<colspec colname="c1" colnum="1" colwidth="1.0*"/>
<colspec colname="c2" colnum="2" colwidth="1.0*"/>
<thead>
<row>
<entry>Name</entry>
<entry>Values</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<ph>element1</ph>
</entry>
<entry>text</entry>
</row>
<row>
<entry>
<ph>element5</ph>
</entry>
<entry>description</entry>
</row>
</tbody>
</tgroup>
</table>
I know that there are other ways to solve this problem. But for other steps in the transformation it is important to test every element separately.
Thanks in advance!
<xsl:output method="xml" indent="yes"/>
<xsl:template match="data">
<xsl:for-each-group select="item" group-by="values/*[language = 'EN']">
<xsl:for-each select="current-group()">
<xsl:element name="{current-group()/values/*[language = 'EN']/local-name()}">
<language>
<xsl:value-of select="descendant::language[text() = 'EN']"/>
</language>
<txt>
<xsl:value-of select="current-group()/values/*[language = 'EN']/text"/>
</txt>
</xsl:element>
</xsl:for-each>
</xsl:for-each-group>
</xsl:template>
You may do like this
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" version="1.0">
<xsl:output indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:variable name="ENelements">
<xsl:for-each select="/data/item/values/*[language='EN']">
<element name="{local-name()}"><xsl:value-of select="text" /></element>
</xsl:for-each>
</xsl:variable>
<table id="123">
<tgroup cols="2">
<colspec colname="c1" colnum="1" colwidth="1.0*"/>
<colspec colname="c2" colnum="2" colwidth="1.0*"/>
<thead>
<row>
<entry>Name</entry>
<entry>Values</entry>
</row>
</thead>
<tbody>
<xsl:for-each select="exsl:node-set($ENelements)/*">
<row>
<entry>
<ph><xsl:value-of select="#name" /></ph>
</entry>
<entry><xsl:value-of select="." /></entry>
</row>
</xsl:for-each>
</tbody>
</tgroup>
</table>
</xsl:template>
</xsl:stylesheet>
http://xsltfiddle.liberty-development.net/jyRYYig
AFAICT, it could be simply:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/data">
<table id="123">
<tgroup cols="2">
<colspec colname="c1" colnum="1" colwidth="1.0*"/>
<colspec colname="c2" colnum="2" colwidth="1.0*"/>
<thead>
<row>
<entry>Name</entry>
<entry>Values</entry>
</row>
</thead>
<tbody>
<xsl:for-each select="item">
<xsl:variable name="elem" select="values/*[language='EN']" />
<row>
<entry>
<ph>
<xsl:value-of select="name($elem)"/>
</ph>
</entry>
<entry>
<xsl:value-of select="$elem/text"/>
</entry>
</row>
</xsl:for-each>
</tbody>
</tgroup>
</table>
</xsl:template>
</xsl:stylesheet>
Maybe you can help me.
I don't know how to sum some table's cell "Year" which are grouped by "Title". I need that sum cell also would be merge as first cell "Title".
I used sum(), but it returs 0.
XMl Code:
<?xml version="1.0" encoding="UTF-8"?>
<LIST>
<Row>
<TITLE>Empire Burlesque</TITLE>
<YEAR>2001</YEAR>
<artist>Bob Dylan</artist>
<artist1>Bob Dylan1</artist1>
</Row>
<Row>
<TITLE>Empire Burlesque</TITLE>
<YEAR>2002</YEAR>
<artist>Bob Dylan</artist>
<artist1>Bob Dylanas</artist1>
</Row>
<Row>
<TITLE>Empire Burlesque</TITLE>
<YEAR>2003</YEAR>
<artist>Bonnie Tyler</artist>
<artist1>Bob Dylan</artist1>
</Row>
<Row>
<TITLE>Empire Burlesque</TITLE>
<YEAR>2004</YEAR>
<artist>Bonnie Tyler</artist>
<artist1>Bob Dylanas</artist1>
</Row>
<Row>
<TITLE>Empire Burlesque1</TITLE>
<YEAR>2005</YEAR>
<artist>Bonnie Tyler</artist>
<artist1>Bob Dylan</artist1>
</Row>
<Row>
<TITLE>Empire Burlesque1</TITLE>
<YEAR>2006</YEAR>
<artist>Bonnie Tyler</artist>
<artist1>Bob Dylanas</artist1>
</Row>
</LIST>
XSLT code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:key name="cds" match="Row" use="TITLE" />
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Year</th>
<th>Artist</th>
<th>Artist1</th>
</tr>
<xsl:for-each select="LIST/Row[generate-id() = generate-id(key('cds', TITLE)[1])]" >
<tr>
<td>
<xsl:if test="key('cds', TITLE)[1]">
<xsl:attribute name="rowspan">
<xsl:value-of select="count(key('cds', TITLE))" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="TITLE"/>
</td>
<td>
<xsl:value-of select="YEAR"/>
</td>
<td>
<xsl:value-of select="artist"/>
</td>
<td>
<xsl:value-of select="artist1"/>
</td>
</tr>
<xsl:for-each select="key('cds', TITLE)[position() > 1]">
<tr>
<td>
<xsl:value-of select="YEAR"/>
</td>
<td>
<xsl:value-of select="artist"/>
</td>
<td>
<xsl:value-of select="artist1"/>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Now result is that:
Try sum(key('cds', TITLE)/YEAR) inside of the for-each.
I have this structure in my xml:
<zoo>
<species name="bird" />
<animal name="crane" />
<animal name="duck" />
<species name="fish" />
<animal name="dolphin" />
<animal name="goldfish" />
</zoo>
which I want to transform into something like this:
<table>
<tr><td> <b>bird</b> </td></tr>
<tr><td> crane </td></tr>
<tr><td> duck </td></tr>
</table>
<table>
<tr><td> <b>fish</b> </td></tr>
<tr><td> dolphin </td></tr>
<tr><td> goldfish </td></tr>
</table>
How can I make this work? I tried using nested for:each'es, but that obviously doesn't work since the nodes are not nested.
Assuming an XSLT 2.0 processor like Saxon 9 or XmlPrime you can use for-each-group group-starting-with="species":
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<htmt>
<head>
<title>group-starting-with</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="zoo">
<xsl:for-each-group select="*" group-starting-with="species">
<table>
<xsl:apply-templates select="current-group()"/>
</table>
</xsl:for-each-group>
</xsl:template>
<xsl:template match="species">
<tr>
<th>
<xsl:value-of select="#name"/>
</th>
</tr>
</xsl:template>
<xsl:template match="animal">
<tr>
<td><xsl:value-of select="#name"/></td>
</tr>
</xsl:template>
</xsl:transform>
Online at http://xsltransform.net/nc4NzRc/1.
My question is a bit similar to XML to HTML table with XSLT .
I have a dictionary defined as follows in XML:
<dictionary>
<languages>
<language>en</language>
<language>ja</language>
</languages>
<entries>
<entry id="1">
<en>Test</en>
<ja>テスト</ja>
</entry>
<entry id="2">
<en>Test2</en>
<ja>テスト2</en>
</entry>
</entries>
</dictionary>
And I would like the following output in XHTML:
<table>
<thead>
<tr>
<th>en</th>
<th>ja</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test</td>
<td>テスト</td>
</tr>
<tr>
<td>Test2</td>
<td>テスト2</td>
</tr>
</tbody>
</table>
I adapted the answer from XML to HTML table with XSLT as follows:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="//dictionary/entries">
<table><xsl:apply-templates select="entry"/></table>
</xsl:template>
<xsl:template match="entry[1]">
<thead><tr><xsl:apply-templates select="*" mode="header"/></tr></thead>
<xsl:call-template name="standardRow"/>
</xsl:template>
<xsl:template match="entry" name="standardRow">
<tbody><tr><xsl:apply-templates select="*"/></tr></tbody>
</xsl:template>
<xsl:template match="entry/*">
<td><xsl:apply-templates select="node()"/></td>
</xsl:template>
<xsl:template match="entry/*" mode="header">
<th><xsl:value-of select="name()"/></th>
</xsl:template>
</xsl:stylesheet>
The thing is that I might have inputs as follows:
<dictionary>
<languages>
<language>en</language>
<language>ja</language>
<language>id</language>
</languages>
<entries>
<entry id="1">
<en>Test</en>
<ja>テスト</ja>
</entry>
<entry id="2">
<ja>テスト2</ja>
<en>Test2</en>
<id>uji2</id>
</entry>
</entries>
</dictionary>
As you might have understood, XSLT takes the first entry node to define the column names and the column id is not generated. Moreover, if the language order is changed in entry the <td> do not appear in order.
With the input above, I would like the following output:
<table>
<thead>
<tr>
<th>en</th>
<th>ja</th>
<th>id</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test</td>
<td>テスト</td>
<td></td>
</tr>
<tr>
<td>Test2</td>
<td>テスト2</td>
<td>Uji2</td>
</tr>
</tbody>
</table>
This is my first time using XSLT and I do not really know how I could do this. I guess I could use the languages node. Please note that the XML input format is flexible and I would welcome any suggestions even if I need to change the format.
Here is a sample stylesheet:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:key name="k1" match="entry/*" use="concat(generate-id(..), '|', local-name())"/>
<xsl:variable name="languages" select="/dictionary/languages/language"/>
<xsl:template match="dictionary">
<xsl:apply-templates select="entries"/>
</xsl:template>
<xsl:template match="entries">
<table>
<thead>
<tr>
<xsl:apply-templates select="$languages" mode="header"/>
</tr>
</thead>
<tbody>
<xsl:apply-templates/>
</tbody>
</table>
</xsl:template>
<xsl:template match="language" mode="header">
<th>
<xsl:value-of select="."/>
</th>
</xsl:template>
<xsl:template match="entry">
<tr>
<xsl:apply-templates select="$languages">
<xsl:with-param name="entry" select="current()"/>
</xsl:apply-templates>
</tr>
</xsl:template>
<xsl:template match="language">
<xsl:param name="entry"/>
<td>
<xsl:value-of select="key('k1', concat(generate-id($entry), '|', .))"/>
</td>
</xsl:template>
</xsl:stylesheet>