Skip to content

Instantly share code, notes, and snippets.

@calaveraInfo
Created August 28, 2017 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calaveraInfo/70f0f5f8ac011898595c3ed3e98bde1f to your computer and use it in GitHub Desktop.
Save calaveraInfo/70f0f5f8ac011898595c3ed3e98bde1f to your computer and use it in GitHub Desktop.
Just a starter template for how to create simple HTML report from XML data directly in browser
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
<pozadavky xmlns="http://calavera.info">
<pozadavek id="1" subdodavka="true" md="1" submd="5">
<text>Some text</text>
</pozadavek>
<pozadavek id="2" subdodavka="false" md="10">
<text>Some other text</text>
<note>Some note</note>
</pozadavek>
</pozadavky>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:my="http://calavera.info"
xmlns:h="http://www.w3.org/1999/xhtml">
<xsl:output method="html" />
<xsl:template match="/">
<h:html>
<h:head>
<h:title>Přehled požadavků na subdodavatele</h:title>
</h:head>
<h:body>
<h:table>
<h:tr>
<h:td>ID</h:td>
<h:td>Text</h:td>
<h:td>Poznámka</h:td>
<h:td>Odhad [MD]</h:td>
<h:td>Subdodavatel</h:td>
<h:td>Subdodavatel odhad [MD]</h:td>
</h:tr>
<xsl:apply-templates select="my:pozadavky/my:pozadavek[contains(@subdodavka,'true')]"/>
</h:table>
</h:body>
</h:html>
</xsl:template>
<xsl:template match="my:pozadavek">
<h:tr>
<h:td><xsl:value-of select="@id"/></h:td>
<h:td><xsl:value-of select="my:text"/></h:td>
<h:td><xsl:value-of select="my:note"/></h:td>
<h:td><xsl:value-of select="@md"/></h:td>
<h:td><xsl:value-of select="@subdodavatel"/></h:td>
<h:td><xsl:value-of select="@submd"/></h:td>
</h:tr>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment