Mercurial > hg > mpdl-group
comparison software/mpdl-services/mpiwg-mpdl-xml-web/WebContent/xsl/generateId.xsl @ 19:4a3641ae14d2
Erstellung
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 09 Nov 2011 15:32:05 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
18:dc5e9fcb3fdc | 19:4a3641ae14d2 |
---|---|
1 <?xml version="1.0"?> | |
2 | |
3 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
4 | |
5 <xsl:output method="xml" encoding="utf-8"/> | |
6 | |
7 <xsl:template match="@*|node()"> | |
8 <xsl:copy> | |
9 <xsl:apply-templates select="@*|node()"/> | |
10 </xsl:copy> | |
11 </xsl:template> | |
12 | |
13 <xsl:template match="*:s|*:head"> | |
14 <xsl:variable name="elemName" select="name()"/> | |
15 <xsl:variable name="docPos"> | |
16 <xsl:choose> | |
17 <xsl:when test="$elemName = 's'"> | |
18 <xsl:value-of select="count(./preceding::*:s) + 1"/> | |
19 </xsl:when> | |
20 <xsl:when test="$elemName = 'head'"> | |
21 <xsl:value-of select="count(./preceding::*:head) + 1"/> | |
22 </xsl:when> | |
23 <xsl:otherwise></xsl:otherwise> | |
24 </xsl:choose> | |
25 </xsl:variable> | |
26 <xsl:copy> | |
27 <xsl:attribute name="xml:id"> | |
28 <xsl:value-of select="concat($elemName, $docPos)"/> | |
29 </xsl:attribute> | |
30 <xsl:apply-templates select="@*|node()"/> | |
31 </xsl:copy> | |
32 </xsl:template> | |
33 | |
34 </xsl:stylesheet> |