93 lines
4.3 KiB
XML
93 lines
4.3 KiB
XML
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" encoding="UTF-8" version="1.0">
|
|
<xsl:output omit-xml-declaration="yes"/>
|
|
|
|
<xsl:template match="/schleudern">
|
|
<xsl:text disable-output-escaping='yes'><?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE schleudern [
|
|
|
|
<!ELEMENT schleudern (schleuder)><!-- wrapper -->
|
|
<!ELEMENT schleuder (date,image,link,filesize,teaser,preface,references,info)><!-- issue date (print) -->
|
|
<!ATTLIST schleuder id CDATA #REQUIRED><!-- issue number -->
|
|
<!ATTLIST schleuder printonly CDATA #IMPLIED><!-- marking for not (yet) downloadable issues -->
|
|
<!ELEMENT date (#PCDATA)><!-- date of publication, https://www.w3.org/Protocols/rfc822/ as in cli `date -R` or 'Thu, 02 May 2019 23:01:34 +0200' -->
|
|
<!ELEMENT image (#PCDATA)><!-- usually the cover page -->
|
|
<!ELEMENT link (#PCDATA)><!-- file location or fallback link, here attachments for rss and linked files for download -->
|
|
<!ATTLIST link filesize CDATA #IMPLIED><!-- attribute filesize for multiple attachments: as PDF, ePUB etc. -->
|
|
<!ELEMENT filesize (#PCDATA)><!-- size of a single linked file, needed for attachments -->
|
|
<!ELEMENT teaser (#PCDATA)><!-- short hint on recent print and newest issue online -->
|
|
<!ELEMENT preface (#PCDATA)><!-- link to preface, html byproduct of ePUB workflow -->
|
|
<!ELEMENT references (#PCDATA)><!-- link to references, html byproduct of ePUB workflow -->
|
|
<!ELEMENT info (#PCDATA)><!-- short information in between two issues, e.g. digital release, added as child to the last published issue, newest first -->
|
|
<!ATTLIST info date CDATA #IMPLIED><!-- date for information, if missing the date of the parent schleuder will be used -->
|
|
|
|
<!ENTITY PUBLISHER "Chaos Computer Club">
|
|
|
|
]>

|
|
</xsl:text>
|
|
<xsl:element name="schleudern"><xsl:text>
</xsl:text>
|
|
|
|
<!--
|
|
<xsl:apply-templates select="//comment()[position()=2]"/>
|
|
-->
|
|
|
|
<xsl:for-each select="schleuder">
|
|
|
|
<xsl:element name="schleuder">
|
|
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
|
<xsl:if test="@printonly != ''">
|
|
<xsl:attribute name="printonly"><xsl:value-of select="@printonly"/></xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:text>
</xsl:text>
|
|
<xsl:if test="count(date) > 0">
|
|
<xsl:text>	</xsl:text><xsl:element name="date"><xsl:value-of select="date"/></xsl:element><xsl:text>
</xsl:text>
|
|
</xsl:if>
|
|
<xsl:text>	</xsl:text><xsl:element name="image"><xsl:value-of select="image"/></xsl:element><xsl:text>
</xsl:text>
|
|
<xsl:for-each select="link">
|
|
<xsl:text>	</xsl:text><xsl:element name="link">
|
|
<xsl:if test="count(@filesize) > 0">
|
|
<xsl:attribute name="filesize"><xsl:value-of select="@filesize"/></xsl:attribute>
|
|
</xsl:if>
|
|
<xsl:value-of select="."/>
|
|
</xsl:element><xsl:text>
</xsl:text>
|
|
<!-- <xsl:if test="position() = 1">
|
|
</xsl:if>-->
|
|
</xsl:for-each>
|
|
<xsl:if test="count(filesize) > 0">
|
|
<xsl:text>	</xsl:text><xsl:element name="filesize"><xsl:value-of select="filesize"/></xsl:element><xsl:text>
</xsl:text>
|
|
</xsl:if>
|
|
<xsl:if test="count(teaser) > 0">
|
|
<xsl:text>	</xsl:text>
|
|
<xsl:apply-templates select="teaser"/>
|
|
<xsl:text>
</xsl:text>
|
|
</xsl:if>
|
|
<xsl:if test="count(preface) > 0">
|
|
<xsl:text>	</xsl:text><xsl:element name="preface">
|
|
<xsl:value-of select="preface"/>
|
|
</xsl:element><xsl:text>
</xsl:text>
|
|
</xsl:if>
|
|
<xsl:if test="count(references) > 0">
|
|
<xsl:text>	</xsl:text><xsl:element name="references">
|
|
<xsl:value-of select="references"/>
|
|
</xsl:element><xsl:text>
</xsl:text>
|
|
</xsl:if>
|
|
<xsl:for-each select="info">
|
|
<xsl:text>	</xsl:text>
|
|
<xsl:apply-templates select="."/>
|
|
<xsl:text>
</xsl:text>
|
|
</xsl:for-each>
|
|
</xsl:element>
|
|
<xsl:text>
</xsl:text>
|
|
|
|
</xsl:for-each>
|
|
|
|
</xsl:element>
|
|
</xsl:template>
|
|
<xsl:template match="comment()"><xsl:comment><xsl:value-of select="."/></xsl:comment></xsl:template>
|
|
<xsl:template match="@*|node()"><!-- matches all -->
|
|
<xsl:copy><!-- copy subtree -->
|
|
<xsl:apply-templates select="@*|node()"/>
|
|
</xsl:copy>
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|