[6] | 1 | <!-- |
---|
| 2 | Extract named artwork elements. |
---|
| 3 | |
---|
| 4 | Copyright (c) 2006 Julian F. Reschke (julian.reschke@greenbytes.de) |
---|
| 5 | |
---|
| 6 | placed into the public domain |
---|
| 7 | --> |
---|
| 8 | |
---|
| 9 | <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
| 10 | version="1.0" |
---|
| 11 | xmlns:x="http://purl.org/net/xml2rfc/ext" |
---|
| 12 | > |
---|
| 13 | |
---|
| 14 | <xsl:import href="clean-for-DTD.xslt"/> |
---|
| 15 | |
---|
| 16 | <xsl:output method="text" encoding="UTF-8"/> |
---|
| 17 | |
---|
| 18 | <xsl:param name="name" /> |
---|
| 19 | <xsl:param name="type" /> |
---|
| 20 | |
---|
| 21 | <xsl:template match="/" priority="9"> |
---|
| 22 | |
---|
| 23 | <xsl:choose> |
---|
| 24 | <xsl:when test="$name!=''"> |
---|
| 25 | <xsl:variable name="artwork" select="//artwork[@name=$name]"/> |
---|
| 26 | |
---|
| 27 | <xsl:choose> |
---|
| 28 | <xsl:when test="$artwork"> |
---|
| 29 | <xsl:for-each select="$artwork"> |
---|
| 30 | <xsl:value-of select="@x:extraction-note"/> |
---|
| 31 | <xsl:apply-templates select="." mode="cleanup"/> |
---|
| 32 | </xsl:for-each> |
---|
| 33 | </xsl:when> |
---|
| 34 | <xsl:otherwise> |
---|
| 35 | <xsl:message>Artwork element named '<xsl:value-of select="$name"/>' not found.</xsl:message> |
---|
| 36 | </xsl:otherwise> |
---|
| 37 | </xsl:choose> |
---|
| 38 | </xsl:when> |
---|
| 39 | <xsl:when test="$type!=''"> |
---|
| 40 | <xsl:variable name="artwork" select="//artwork[@type=$type]"/> |
---|
| 41 | |
---|
| 42 | <xsl:choose> |
---|
| 43 | <xsl:when test="$artwork"> |
---|
| 44 | <xsl:for-each select="$artwork"> |
---|
| 45 | <xsl:value-of select="@x:extraction-note"/> |
---|
| 46 | <xsl:apply-templates select="." mode="cleanup"/> |
---|
| 47 | </xsl:for-each> |
---|
| 48 | </xsl:when> |
---|
| 49 | <xsl:otherwise> |
---|
| 50 | <xsl:message>Artwork element typed '<xsl:value-of select="$type"/>' not found.</xsl:message> |
---|
| 51 | </xsl:otherwise> |
---|
| 52 | </xsl:choose> |
---|
| 53 | </xsl:when> |
---|
| 54 | <xsl:otherwise> |
---|
| 55 | <xsl:message>Please specify either name or type parameter.</xsl:message> |
---|
| 56 | </xsl:otherwise> |
---|
| 57 | </xsl:choose> |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | </xsl:template> |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | </xsl:transform> |
---|