diff options
Diffstat (limited to 'ebus-xml/transform/ebus.docbook.xslt')
-rw-r--r-- | ebus-xml/transform/ebus.docbook.xslt | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/ebus-xml/transform/ebus.docbook.xslt b/ebus-xml/transform/ebus.docbook.xslt new file mode 100644 index 0000000..4f147f4 --- /dev/null +++ b/ebus-xml/transform/ebus.docbook.xslt @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="utf8"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:ebus="http://xapek.org/ebus/0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xapek.org/ebus/0.1 ebus-0.1.xsd" + xmlns:db="http://docbook.org/ns/docbook"> + <xsl:output method="xml" indent="yes" /> + + <xsl:template match="/"> + <db:book version="5.0" xml:lang="de"> + <db:bookinfo> + <db:title>Ebus Protokollbeschreibung</db:title> + <db:author> + <db:firstname>Yves</db:firstname> + <db:surname>Fischer</db:surname> + </db:author> + </db:bookinfo> + <db:chapter> + <db:title>Adressen</db:title> + <db:sect1> + <db:title>Master-Adressen</db:title> + <xsl:for-each select="ebus:ebus/ebus:devices/ebus:device[@type='master']"> + <xsl:call-template name="do_device" /> + </xsl:for-each> + </db:sect1> + <db:sect1> + <db:title>Slave-Adressen</db:title> + <xsl:for-each select="ebus:ebus/ebus:devices/ebus:device[@type='slave']"> + <xsl:call-template name="do_device" /> + </xsl:for-each> + </db:sect1> + <db:sect1> + <db:title>Broadcast-Adressen</db:title> + <xsl:for-each select="ebus:ebus/ebus:devices/ebus:device[@type='broadcast']"> + <xsl:call-template name="do_device" /> + </xsl:for-each> + </db:sect1> + </db:chapter> + <db:chapter> + <db:title>Pakete</db:title> + <xsl:for-each select="ebus:ebus/ebus:packets/ebus:packet"> + <xsl:call-template name="do_packet" /> + </xsl:for-each> + </db:chapter> + </db:book> + </xsl:template> + + <xsl:template name="do_device"> + <db:sect2> + <db:title>Gerät: <xsl:value-of select="@name" /></db:title> + <db:informaltable pgwide="1"> + <db:tgroup cols="2"> + <db:colspec colname="c1"/> + <db:colspec colname="c2"/> + <db:tbody> + <db:row> + <db:entry>Name</db:entry> + <db:entry><xsl:value-of select="@name" /></db:entry> + </db:row> + <db:row> + <db:entry>Address</db:entry> + <db:entry><xsl:value-of select="@address" /></db:entry> + </db:row> + <db:row> + <db:entry>Typ</db:entry> + <db:entry><xsl:value-of select="@type" /></db:entry> + </db:row> + </db:tbody> + </db:tgroup> + </db:informaltable> + <xsl:if test="ebus:description"> + <xsl:for-each select="ebus:description"> + <db:blockquote> + <db:title>Description <xsl:value-of select="@lang" /></db:title> + <db:para><xsl:value-of select="text()" /></db:para> + </db:blockquote> + </xsl:for-each> + </xsl:if> + </db:sect2> + </xsl:template> + + <xsl:template name="do_packet"> + <db:sect1> + <db:title>Paket: <xsl:value-of select="@name" /></db:title> + <db:informaltable pgwide="1"> + <db:tgroup cols="2"> + <db:colspec colname="c1"/> + <db:colspec colname="c2"/> + <db:tbody> + <db:row> + <db:entry>Name</db:entry> + <db:entry><xsl:value-of select="@name" /></db:entry> + </db:row> + <db:row> + <db:entry>Primary</db:entry> + <db:entry><xsl:value-of select="@primary" /></db:entry> + </db:row> + <db:row> + <db:entry>Secondary</db:entry> + <db:entry><xsl:value-of select="@secondary" /></db:entry> + </db:row> + </db:tbody> + </db:tgroup> + </db:informaltable> + <xsl:if test="ebus:description"> + <xsl:for-each select="ebus:description"> + <db:blockquote> + <db:title>Description <xsl:value-of select="@lang" /></db:title> + <db:para><xsl:value-of select="text()" /></db:para> + </db:blockquote> + </xsl:for-each> + </xsl:if> + <xsl:if test="count(ebus:fields/*) > 0"> + <xsl:for-each select="ebus:fields/*"> + <xsl:call-template name="do_field" /> + </xsl:for-each> + </xsl:if> + </db:sect1> + </xsl:template> + + <xsl:template name="do_field"> + <db:sect2> + <db:title>Feld <xsl:value-of select="@name" /></db:title> + <db:informaltable pgwide="1"> + <db:tgroup cols="2"> + <db:colspec colname="c1"/> + <db:colspec colname="c2"/> + <db:tbody> + <db:row> + <db:entry>Name</db:entry> + <db:entry><xsl:value-of select="@name" /></db:entry> + </db:row> + <db:row> + <db:entry>Typ</db:entry> + <db:entry><xsl:value-of select="name()" /></db:entry> + </db:row> + <db:row> + <db:entry>offset</db:entry> + <db:entry><xsl:value-of select="@offset" /></db:entry> + </db:row> + </db:tbody> + </db:tgroup> + </db:informaltable> + + <xsl:if test="name() = 'byteEnum'"> + <db:para>Enum Werte</db:para> + <db:informaltable pgwide="1"> + <db:tgroup cols="2"> + <db:colspec colname="c1"/> + <db:colspec colname="c2"/> + <db:tbody> + <xsl:for-each select="ebus:option"> + <db:row> + <db:entry><xsl:value-of select="@value" /></db:entry> + <db:entry><xsl:value-of select="@name" /></db:entry> + </db:row> + <xsl:for-each select="ebus:description"> + <db:row> + <db:entry namest="c1" nameend="c2"> + <db:emphasis> + <xsl:value-of select="text()" /> + </db:emphasis> + </db:entry> + </db:row> + </xsl:for-each> + </xsl:for-each> + </db:tbody> + </db:tgroup> + </db:informaltable> + </xsl:if> + + <xsl:if test="ebus:description"> + <xsl:for-each select="ebus:description"> + <db:blockquote> + <db:title>Description <xsl:value-of select="@lang" /></db:title> + <db:para><xsl:value-of select="text()" /></db:para> + </db:blockquote> + </xsl:for-each> + </xsl:if> + </db:sect2> + </xsl:template> +</xsl:stylesheet> |