1<?xml version="1.0"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
4  <xsl:output encoding="utf-8"/>
5
6  <xsl:template match="table">
7    <xsl:for-each select="row">
8      <xsl:text>
9      </xsl:text>
10      <person>
11        <xsl:value-of select="concat(firstname, ' ', lastname)"/>
12        <xsl:value-of select="string-length(firstname)"/>
13        <!-- rot13 -->
14        <xsl:value-of select="translate(firstname,
15                              'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
16                              'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM')"/>
17        <xsl:value-of select="sum(preceding-sibling::row/id)"/>
18        <xsl:value-of select="floor(id div 17)"/>
19        <xsl:value-of select="ceiling(id*3.1415)"/>
20        <xsl:value-of select="substring(lastname,4,3)"/>
21      </person>
22      <extra>
23        <xsl:if test="starts-with(id,'001')">
24          <xsl:value-of select="zip"/>
25        </xsl:if>
26        <xsl:if test="contains(lastname,'k')">
27          <xsl:value-of select="substring-after(lastname,'k')"/>
28        </xsl:if>
29      </extra>
30
31
32
33    </xsl:for-each>
34    <xsl:text>
35    </xsl:text>
36
37  </xsl:template>
38
39</xsl:stylesheet>
40
41
42