Introducing the Recordx-XSLT gem

require 'recordx-xslt'

recxslt = RecordxXSLT.new(schema: 'month[label]/week[no]/day[x,wday]', xslt_schema: 'table[caption:label]/tr/td[div:x,div,div:event]')
puts recxslt.to_xslt

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />

<xsl:template match='month'>
  <table>
    <xsl:apply-templates select='summary'/>
  </table>
</xsl:template>

<xsl:template match='month/summary'>
    <caption><xsl:value-of select='label'/></caption>
</xsl:template>

<xsl:template match='records/week'>
  <tr>
    <xsl:apply-templates select='summary'/>
    <xsl:apply-templates select='records'/>
  </tr>
</xsl:template>

<xsl:template match='week/summary'>
</xsl:template>

<xsl:template match='records/day'>
  <td>
    <xsl:apply-templates select='summary'/>
  </td>
</xsl:template>

<xsl:template match='day/summary'>
    <div><xsl:value-of select='x'/></div>
    <div></div>
    <div><xsl:value-of select='event'/></div>
</xsl:template>

</xsl:stylesheet>

Resources

Tags:
Source:
1128hrs.txt
Published:
06-09-2014 11:28