diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-08-13 15:01:39 +0200 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-08-13 20:28:10 +0200 |
commit | 053fc7997104605c2debb45ad62535ab1513c921 (patch) | |
tree | 2becf1ec5f46c8d244ce66bf6043cecb7e936ebb /ebus-xml/transform/ebus.docbook.xslt | |
parent | 2ccd5f3192d80bed75578c2e31e3d145c9e1a4ed (diff) | |
download | ebus-alt-master.tar.gz ebus-alt-master.zip |
Diffstat (limited to 'ebus-xml/transform/ebus.docbook.xslt')
-rw-r--r-- | ebus-xml/transform/ebus.docbook.xslt | 338 |
1 files changed, 199 insertions, 139 deletions
diff --git a/ebus-xml/transform/ebus.docbook.xslt b/ebus-xml/transform/ebus.docbook.xslt index 4f147f4..80c024d 100644 --- a/ebus-xml/transform/ebus.docbook.xslt +++ b/ebus-xml/transform/ebus.docbook.xslt @@ -1,182 +1,242 @@ <?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" /> + 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" + xmlns:db="http://docbook.org/ns/docbook" + xsi:schemaLocation="http://xapek.org/ebus/0.1 ../ebus-0.1.xsd http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd" +> + <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <db:book version="5.0" xml:lang="de"> - <db:bookinfo> + <db:info> <db:title>Ebus Protokollbeschreibung</db:title> <db:author> - <db:firstname>Yves</db:firstname> - <db:surname>Fischer</db:surname> + <db:personname>Yves Fischer</db:personname> + <db:email>yvesf+git@xapek.org</db:email> </db:author> - </db:bookinfo> + </db:info> <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:title>Master Adressen</db:title> + <xsl:call-template name="do_devices"> + <xsl:with-param name="type" select="'master'"/> + </xsl:call-template> </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:title>Slave Adressen</db:title> + <xsl:call-template name="do_devices"> + <xsl:with-param name="type" select="'slave'"/> + </xsl:call-template> </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:title>Broadcast Adressen</db:title> + <xsl:call-template name="do_devices"> + <xsl:with-param name="type" select="'broadcast'"/> + </xsl:call-template> </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:informaltable pgwide="1"> + <db:tgroup cols="3"> + <db:colspec colnum="1" colname="c1" colwidth="5cm"/> + <db:colspec colnum="2" colname="c2" colwidth="1.8cm"/> + <db:colspec colnum="3" colname="c3"/> + <db:thead> + <db:row> + <db:entry>Packet</db:entry> + <db:entry>Prim./Sec. Address</db:entry> + <db:entry>Description</db:entry> + </db:row> + </db:thead> + <db:tbody> + <xsl:for-each select="ebus:ebus/ebus:packets/ebus:packet"> + <db:row> + <db:entry> + <xsl:element name="db:link"> + <xsl:attribute name="linkend"> + <xsl:value-of select="concat('link.packet.', @name)"/> + </xsl:attribute> + <xsl:value-of select="@name"/> + </xsl:element> + </db:entry> + <db:entry> + <db:computeroutput> + <xsl:value-of select="format-number(@primary, '00')"/> / + <xsl:value-of select="format-number(@secondary, '00')"/> + </db:computeroutput> + </db:entry> + <db:entry> + <xsl:for-each select="ebus:description"> + <db:para> + <db:emphasis><xsl:value-of select="@lang"/>: + </db:emphasis> + <xsl:value-of select="text()"/> + </db:para> + </xsl:for-each> + </db:entry> + </db:row> + </xsl:for-each> + </db:tbody> + </db:tgroup> + </db:informaltable> + <db:sect1> + <db:title>Fields</db:title> + <xsl:for-each select="ebus:ebus/ebus:packets/ebus:packet"> + <xsl:call-template name="do_packet"/> + </xsl:for-each> + </db:sect1> </db:chapter> </db:book> </xsl:template> - <xsl:template name="do_device"> + <xsl:template name="do_packet"> <db:sect2> - <db:title>Gerät: <xsl:value-of select="@name" /></db:title> + <db:title> + <xsl:value-of select="@name"/> + </db:title> + <xsl:element name="db:anchor"> + <xsl:attribute name="id"> + <xsl:value-of select="concat('link.packet.', @name)"/> + </xsl:attribute> + </xsl:element> + <db:informaltable pgwide="1"> - <db:tgroup cols="2"> + <db:tgroup cols="4"> <db:colspec colname="c1"/> - <db:colspec colname="c2"/> - <db:tbody> + <db:colspec colname="c2" colwidth=".8cm"/> + <db:colspec colname="c3" colwidth="1.5cm"/> + <db:colspec colname="c4"/> + <db:thead> <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:entry>Offset</db:entry> + <db:entry>Type</db:entry> + <db:entry>Description</db:entry> </db:row> + </db:thead> + <db:tbody> + <xsl:for-each select="ebus:fields/*"> + <db:row> + <db:entry> + <xsl:value-of select="@name"/> + </db:entry> + <db:entry> + <xsl:value-of select="@offset"/> + </db:entry> + <db:entry> + <xsl:value-of select="name()"/> + </db:entry> + <db:entry> + <xsl:for-each select="ebus:description"> + <db:para> + <db:emphasis> + <xsl:value-of select="concat(@lang, ': ')"/> + </db:emphasis> + <xsl:value-of select="text()"/> + </db:para> + </xsl:for-each> + </db:entry> + </db:row> + + <xsl:if test="name() = 'byteEnum'"> + <db:row> + <db:entry namest="c1" nameend="c4"> + <xsl:call-template name="enuminfo"/> + </db:entry> + </db:row> + </xsl:if> + </xsl:for-each> </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:for-each select="ebus:fields/*"> + + </xsl:for-each> </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> + <xsl:template name="enuminfo"> + <db:informaltable pgwide="1"> + <db:tgroup cols="3"> + <db:colspec colname="c1"/> + <db:colspec colname="c2"/> + <db:colspec colname="c3"/> + <db:thead> + <db:row> + <db:entry>Code</db:entry> + <db:entry>Name</db:entry> + <db:entry>Description</db:entry> + </db:row> + </db:thead> + <db:tbody> + <xsl:for-each select="ebus:option"> <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:entry> + <xsl:value-of select="@value"/> + </db:entry> + <db:entry> + <xsl:value-of select="@name"/> + </db:entry> + <db:entry> + <xsl:for-each select="ebus:description"> + <db:para> + <db:emphasis> + <xsl:value-of select="concat(@lang, ': ')"/> + </db:emphasis> + <xsl:value-of select="text()"/> + </db:para> + </xsl:for-each> + </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:for-each> + </db:tbody> + </db:tgroup> + </db:informaltable> + <db:para/> </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> + <xsl:template name="do_devices"> + <xsl:param name="type"/> + <db:informaltable pgwide="1" frame="none"> + <db:tgroup cols="3"> + <db:colspec colname="c1"/> + <db:colspec colname="c2"/> + <db:colspec colname="c3"/> + <db:thead> + <db:row> + <db:entry>Gerät</db:entry> + <db:entry>Address</db:entry> + <db:entry>Description</db:entry> + </db:row> + </db:thead> + <db:tbody> + <xsl:for-each select="ebus:ebus/ebus:devices/ebus:device[@type=$type]"> <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> + <db:entry> + <xsl:value-of select="@name"/> + </db:entry> + <db:entry> + <xsl:value-of select="@address"/> + </db:entry> + <db:entry> <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> + <db:para> + <db:emphasis> + <xsl:value-of select="concat(@lang, ': ')"/> + </db:emphasis> + <xsl:value-of select="text()"/> + </db:para> </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> + </db:entry> + </db:row> + </xsl:for-each> + </db:tbody> + </db:tgroup> + </db:informaltable> </xsl:template> -</xsl:stylesheet> +</xsl:stylesheet>
\ No newline at end of file |