45 lines
1.2 KiB
XML
45 lines
1.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<xsl:stylesheet version="1.0"
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
|
|
<!-- identity copy -->
|
|
<xsl:template match="@*|node()">
|
|
<xsl:copy>
|
|
<xsl:apply-templates select="@*|node()" />
|
|
</xsl:copy>
|
|
</xsl:template>
|
|
|
|
<!-- modify programme/episode-num -->
|
|
<xsl:template match="programme[season-num and episode-num]/episode-num">
|
|
<xsl:variable name="s" select="../season-num"/>
|
|
<xsl:variable name="e" select="."/>
|
|
|
|
<xsl:variable name="s2">
|
|
<xsl:choose>
|
|
<xsl:when test="string-length($s) = 1">
|
|
<xsl:value-of select="concat('0',$s)"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="$s"/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="e2">
|
|
<xsl:choose>
|
|
<xsl:when test="string-length($e) = 1">
|
|
<xsl:value-of select="concat('0',$e)"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="$e"/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
|
|
<episode-num>
|
|
<xsl:value-of select="concat('S',$s2,'E',$e2)"/>
|
|
</episode-num>
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|