summaryrefslogtreecommitdiff
path: root/ebus-xml/transform
diff options
context:
space:
mode:
Diffstat (limited to 'ebus-xml/transform')
-rw-r--r--ebus-xml/transform/ebus.docbook.xslt182
-rw-r--r--ebus-xml/transform/ebus.html.xslt112
-rw-r--r--ebus-xml/transform/ebus.txt.xslt49
3 files changed, 182 insertions, 161 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/*) &gt; 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>
diff --git a/ebus-xml/transform/ebus.html.xslt b/ebus-xml/transform/ebus.html.xslt
deleted file mode 100644
index bf2d031..0000000
--- a/ebus-xml/transform/ebus.html.xslt
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:template match="/">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
- <style type="text/css">
- table {
- border: 1px solid gray;
- width: 100%;
- }
- table td {
- border-left: 1px dotted gray;
- border-right: 1px
- dotted gray;
- }
-
- table th {
- border: 1px dotted gray;
- }
- </style>
- </head>
- <body>
- <h2>Ebus Geräte</h2>
- <table class="devices">
- <tr>
- <th>Adresse</th>
- <th>Gerät</th>
- <th>Typ</th>
- </tr>
- <xsl:for-each select="ebus/devices/device">
- <tr>
- <td>
- <!-- anchor -->
- <xsl:value-of select="@address" />
- </td>
- <td>
- <xsl:value-of select="text()" />
- </td>
- <td>
- <xsl:value-of select="@type" />
- </td>
- </tr>
- </xsl:for-each>
- </table>
-
- <h2>Ebus Pakete</h2>
- <table class="packets">
- <tr>
- <th>Primary Command</th>
- <th>Secondary Command</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- <xsl:for-each select="ebus/packets/packet">
- <tr>
- <td>
- <xsl:value-of select="@primary" />
- </td>
- <td>
- <xsl:value-of select="@secondary" />
- </td>
- <td>
- <xsl:value-of select="@name" />
- </td>
- <td>
- <xsl:value-of select="@description" />
- </td>
- </tr>
- <tr>
- <td />
- <td colspan="3">
- <table class="fields">
- <tr>
- <th>offset</th>
- <th>typ</th>
- <th>name</th>
- <th>Description</th>
- </tr>
- <xsl:for-each select="fields/*">
- <tr>
- <td>
- <xsl:value-of select="@offset" />
- </td>
- <td>
- <xsl:value-of select="name()" />
- </td>
- <td>
- <xsl:value-of select="@name" />
- </td>
- <td>
- <xsl:value-of select="text()" />
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="4">
- <hr />
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/ebus-xml/transform/ebus.txt.xslt b/ebus-xml/transform/ebus.txt.xslt
deleted file mode 100644
index dda1e33..0000000
--- a/ebus-xml/transform/ebus.txt.xslt
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
-<xsl:stylesheet version="1.0"
-xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!-- TODO: padding -->
- <xsl:output method="text" />
- <xsl:template match="/">
-=== Ebus Geräte
-
-Adresse | Gerät | Typ
-
- <xsl:for-each select="ebus/devices/device">
- <xsl:value-of select="@address"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="text()"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="@type"/>
- <xsl:text>
-</xsl:text>
- </xsl:for-each>
-
-=== Ebus Pakete
-
-Primary Command | Secondary Command | Name | Description
- ---- offset | typ | name | description
- <xsl:for-each select="ebus/packets/packet">
- <xsl:value-of select="@primary"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="@secondary"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="@description"/>
-
- <xsl:for-each select="fields/*">
- <xsl:value-of select="@offset"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="name()"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:text>|</xsl:text>
- <xsl:value-of select="text()"/>
- <xsl:text>
- </xsl:text>
- </xsl:for-each>
- <xsl:text>
- </xsl:text>
- </xsl:for-each>
- </xsl:template>
-</xsl:stylesheet>