| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
<xsl:stylesheet version="1.0" |
| 24 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 25 |
xmlns:g="http://gramps-project.org/xml/1.4.0/"> |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
<xsl:output method="xml"/> |
| 35 |
|
| 36 |
<xsl:param name="replace_handles"/> |
| 37 |
<xsl:key name="primary_obj" match="g:person|g:family|g:event|g:placeobj|g:source|g:repository|g:object|g:note|g:tag" use="@handle"/> |
| 38 |
|
| 39 |
<xsl:template match="*|@*|text()"> |
| 40 |
<xsl:copy> |
| 41 |
<xsl:apply-templates select="*|@*|text()"/> |
| 42 |
</xsl:copy> |
| 43 |
</xsl:template> |
| 44 |
|
| 45 |
<xsl:template match="@change"> |
| 46 |
</xsl:template> |
| 47 |
|
| 48 |
<xsl:template match="g:researcher"> |
| 49 |
<xsl:copy/> |
| 50 |
</xsl:template> |
| 51 |
|
| 52 |
<xsl:template match="g:people|g:families|g:events|g:places|g:sources|g:repositories|g:objects|g:notes|g:tags"> |
| 53 |
<xsl:copy> |
| 54 |
<xsl:apply-templates select="*"> |
| 55 |
<xsl:sort select="@id"/> |
| 56 |
</xsl:apply-templates> |
| 57 |
</xsl:copy> |
| 58 |
</xsl:template> |
| 59 |
|
| 60 |
<xsl:template match="@handle"> |
| 61 |
<xsl:choose> |
| 62 |
<xsl:when test="$replace_handles='ID'"> |
| 63 |
<xsl:attribute name="handle"> |
| 64 |
<xsl:value-of select="../@id"/> |
| 65 |
</xsl:attribute> |
| 66 |
</xsl:when> |
| 67 |
<xsl:when test="$replace_handles='strip'"> |
| 68 |
</xsl:when> |
| 69 |
<xsl:otherwise> |
| 70 |
<xsl:copy/> |
| 71 |
</xsl:otherwise> |
| 72 |
</xsl:choose> |
| 73 |
</xsl:template> |
| 74 |
|
| 75 |
<xsl:template match="@hlink"> |
| 76 |
<xsl:choose> |
| 77 |
<xsl:when test="$replace_handles='ID'"> |
| 78 |
<xsl:attribute name="hlink"> |
| 79 |
<xsl:value-of select="key('primary_obj',.)/@id"/> |
| 80 |
</xsl:attribute> |
| 81 |
</xsl:when> |
| 82 |
<xsl:when test="$replace_handles='strip'"> |
| 83 |
</xsl:when> |
| 84 |
<xsl:otherwise> |
| 85 |
<xsl:copy/> |
| 86 |
</xsl:otherwise> |
| 87 |
</xsl:choose> |
| 88 |
</xsl:template> |
| 89 |
|
| 90 |
</xsl:stylesheet> |