Jump to content

User:Dr pda/ref2tab.stx

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

<?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="string(.)"/>    

</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="PND"/> <stx:variable name="pnd-count"/>

<stx:template match="parsed">

 <stx:assign name="pnd-count" select="0"/>
 <stx:assign name="PND"/> 
 <stx:process-children/>
 <stx:if test="$pnd-count > 1">
   <stx:message>
     <stx:value-of select="$pnd-count"/>
     <stx:text> PND:</stx:text>
     <stx:value-of select="$page-title"/>
     <stx:text>
</stx:text>
   </stx:message>
 </stx:if>

 <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="$PND"/>
   <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='PND'">
     <stx:assign name="pnd-count" select="$pnd-count + 1"/>
     <stx:assign name="PND"/>
   </stx:when>
 </stx:choose>
 <stx:process-children/>

</stx:template>

<stx:template match="param">

 <stx:choose>
   <stx:when test="$template-name = 'PND'">
     <stx:assign name="PND" select="normalize-space(.)"/>
   </stx:when>
 </stx:choose>

</stx:template>

</stx:transform>