User:Dr pda/class2tab.stx
<?xml version="1.0"?> <stx:transform version="1.0"
xmlns:stx="http://stx.sourceforge.net/2002/ns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" output-method="text" pass-through="none"
>
<stx:template match="/mediawiki">
<stx:process-children />
</stx:template>
<stx:variable name="page-title"/> <stx:variable name="page-id"/> <stx:variable name="template-name"/>
<stx:template match="title">
<stx:assign name="page-title" select="substring-after(.,':')"/>
</stx:template>
<stx:template match="page">
<stx:assign name="page-id"/> <stx:process-children/>
</stx:template>
<stx:template match="id">
<stx:assign name="page-id" select="normalize-space(.)"/>
</stx:template>
<stx:template match="revision">
<stx:process-children/>
</stx:template>
<stx:variable name="fa-class"/> <stx:variable name="fl-class"/> <stx:variable name="a-class"/> <stx:variable name="ga-class"/> <stx:variable name="b-class"/> <stx:variable name="c-class"/> <stx:variable name="start-class"/> <stx:variable name="stub-class"/> <stx:variable name="list-class"/>
<stx:variable name="pnd-count"/>
<stx:template match="parsed">
<stx:assign name="pnd-count" select="0"/> <stx:assign name="fa-class"/> <stx:assign name="fl-class"/> <stx:assign name="a-class"/> <stx:assign name="ga-class"/> <stx:assign name="b-class"/> <stx:assign name="c-class"/> <stx:assign name="start-class"/> <stx:assign name="stub-class"/> <stx:assign name="list-class"/>
<stx:process-children/>
<stx:if test="$pnd-count > 0"> <stx:value-of select="$page-id"/> <stx:text> </stx:text> <stx:value-of select="$page-title"/> <stx:text> </stx:text> <stx:value-of select="$fa-class"/> <stx:text> </stx:text> <stx:value-of select="$fl-class"/> <stx:text> </stx:text> <stx:value-of select="$a-class"/> <stx:text> </stx:text> <stx:value-of select="$ga-class"/> <stx:text> </stx:text> <stx:value-of select="$b-class"/> <stx:text> </stx:text> <stx:value-of select="$c-class"/> <stx:text> </stx:text> <stx:value-of select="$start-class"/> <stx:text> </stx:text> <stx:value-of select="$stub-class"/> <stx:text> </stx:text> <stx:value-of select="$list-class"/> <stx:text> </stx:text> </stx:if>
</stx:template>
<stx:template match="template">
<stx:assign name="template-name" select="@name"/> <stx:choose> <stx:when test="$template-name='classes'"> <stx:assign name="pnd-count" select="$pnd-count + 1"/> <stx:assign name="fa-class"/> <stx:assign name="fl-class"/> <stx:assign name="a-class"/> <stx:assign name="ga-class"/> <stx:assign name="b-class"/> <stx:assign name="c-class"/> <stx:assign name="start-class"/> <stx:assign name="stub-class"/> <stx:assign name="list-class"/> </stx:when> </stx:choose> <stx:process-children/>
</stx:template>
<stx:template match="param">
<stx:choose> <stx:when test="$template-name='classes'"> <stx:choose> <stx:when test="@name = 'fa'"> <stx:assign name="fa-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'fl'"> <stx:assign name="fl-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'a'"> <stx:assign name="a-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'ga'"> <stx:assign name="ga-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'b'"> <stx:assign name="b-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'c'"> <stx:assign name="c-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'start'"> <stx:assign name="start-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'stub'"> <stx:assign name="stub-class" select="normalize-space(.)"/> </stx:when> <stx:when test="@name = 'list'"> <stx:assign name="list-class" select="normalize-space(.)"/> </stx:when> </stx:choose> </stx:when> </stx:choose>
</stx:template>
</stx:transform>