Wikipedia:Persondata/pd2tab.stx

From Wikipedia, the free encyclopedia
Jump to: navigation, search
<?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="NAME"/>
<stx:variable name="ALTERNATIVNAMEN"/>
<stx:variable name="KURZBESCHREIBUNG"/>
<stx:variable name="GEBURTSDATUM"/>
<stx:variable name="GEBURTSORT"/>
<stx:variable name="STERBEDATUM"/>
<stx:variable name="STERBEORT"/>
<stx:variable name="PND"/>

<stx:variable name="pd-count"/>
<stx:variable name="pnd-count"/>

<stx:template match="parsed">
  <stx:assign name="pd-count" select="0"/>
  <stx:assign name="pnd-count" select="0"/>

  <stx:assign name="NAME"/>
  <stx:assign name="ALTERNATIVNAMEN"/>
  <stx:assign name="ALTERNATIVNAMEN"/>
  <stx:assign name="KURZBESCHREIBUNG"/>
  <stx:assign name="GEBURTSDATUM"/>
  <stx:assign name="GEBURTSORT"/>
  <stx:assign name="STERBEDATUM"/>
  <stx:assign name="STERBEORT"/>  
  <stx:assign name="PND"/>
  
  <stx:process-children/>  

  <stx:if test="$pd-count > 1">
    <stx:message>
      <stx:value-of select="$pd-count"/>
      <stx:text> Personendaten:</stx:text>
      <stx:value-of select="$page-title"/>
      <stx:text>
</stx:text>
    </stx:message>  
  </stx:if>

  <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="$pd-count > 0 or $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="$NAME"/>
    <stx:text>	</stx:text>
    <stx:value-of select="$ALTERNATIVNAMEN"/>
    <stx:text>	</stx:text>  
    <stx:value-of select="$KURZBESCHREIBUNG"/>
    <stx:text>	</stx:text>
    <stx:value-of select="$GEBURTSDATUM"/>
    <stx:text>	</stx:text>
    <stx:value-of select="$GEBURTSORT"/>
    <stx:text>	</stx:text>
    <stx:value-of select="$STERBEDATUM"/>
    <stx:text>	</stx:text>
    <stx:value-of select="$STERBEORT"/>
    <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='Persondata'">
      <stx:assign name="pd-count" select="$pd-count + 1"/>
      <stx:assign name="NAME"/>
      <stx:assign name="ALTERNATIVNAMEN"/>
      <stx:assign name="ALTERNATIVNAMEN"/>
      <stx:assign name="KURZBESCHREIBUNG"/>
      <stx:assign name="GEBURTSDATUM"/>
      <stx:assign name="GEBURTSORT"/>
      <stx:assign name="STERBEDATUM"/>
      <stx:assign name="STERBEORT"/>
    </stx:when>
    <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='Persondata'"> 
      <stx:choose>
        <stx:when test="@name = 'NAME'">
          <stx:assign name="NAME" select="normalize-space(.)"/>
        </stx:when>
        <stx:when test="@name = 'ALTERNATIVE NAME'">
          <stx:assign name="ALTERNATIVNAMEN" select="normalize-space(.)"/>
        </stx:when>
        <stx:when test="@name = 'SHORT DESCRIPTION'">
          <stx:assign name="KURZBESCHREIBUNG" select="normalize-space(.)"/>
        </stx:when>
        <stx:when test="@name = 'PLACE OF BIRTH'">
          <stx:assign name="GEBURTSORT" select="normalize-space(.)"/>
        </stx:when>
        <stx:when test="@name = 'DATE OF BIRTH'">
          <stx:assign name="GEBURTSDATUM" select="normalize-space(.)"/>
        </stx:when>
        <stx:when test="@name = 'PLACE OF DEATH'">
          <stx:assign name="STERBEORT" select="normalize-space(.)"/>
        </stx:when>
        <stx:when test="@name = 'DATE OF DEATH'">
          <stx:assign name="STERBEDATUM" select="normalize-space(.)"/>
        </stx:when>
      </stx:choose>
    </stx:when>  
    <stx:when test="$template-name = 'PND'">
      <stx:assign name="PND" select="normalize-space(.)"/>
    </stx:when>
  </stx:choose>
</stx:template>

</stx:transform>