view software/eXist/webapp/mpdl/presentation/functions-util.xsl @ 7:5589d865af7a

Erstellung XQL/XSL Applikation
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 08 Feb 2011 15:16:46 +0100
parents
children
line wrap: on
line source

<?xml version="1.0"?>
<xsl:stylesheet version="2.0" 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 xmlns:xlink="http://www.w3.org/1999/xlink"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:mpdl-util="http://www.mpiwg-berlin.mpg.de/ns/mpdl/util">

<xsl:function name="mpdl-util:copyWithoutNamespace">
  <xsl:param name="myElem"/>
  <xsl:for-each select="$myElem">
    <xsl:choose>
      <xsl:when test="self::*">  <!--myElem is an element-->
        <xsl:element name="{$myElem/name()}" namespace="">
          <xsl:copy-of select="$myElem/@*"/>   <!-- attributes -->
          <xsl:for-each select="$myElem/* | $myElem/text()">    <!-- element and text child nodes of the node -->
            <xsl:sequence select="mpdl-util:copyWithoutNamespace(.)"/>
          </xsl:for-each>
        </xsl:element>
      </xsl:when>
      <xsl:when test="self::text()">    <!-- text -->
        <xsl:text></xsl:text><xsl:value-of select="."/> 
      </xsl:when>
      <xsl:otherwise></xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>

</xsl:stylesheet>