<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:output method="text"/>
  <xsl:template match="//list">
    <xsl:for-each select="item">
      <xsl:apply-templates select="dictionary"/>
      <xsl:text>
</xsl:text>
    </xsl:for-each>
  </xsl:template>

  <xsl:template match="dictionary">
    <xsl:for-each select="item">
      <xsl:value-of select="text()"/>
      <xsl:if test="position() &lt; last()">
        <xsl:text>|</xsl:text>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

  <!-- suppress unneeded textual content -->
  <xsl:template match="text()"/>

</xsl:stylesheet>
