0.0
No commit activity in last 3 years
No release in over 3 years
Generates XSLT to produce a Polyrex document from a tree-like XML structure.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.5, >= 1.5.2
 Project Readme

Introducing the Polyrex-XSLT gem

Usage

require 'polyrex-xslt'

schema = 'entries/entry[title]'
xslt_schema = 'tree/item[@title:title, @qty:qty]'

pxsl = PolyrexXSLT.new schema: schema, xslt_schema: xslt_schema
puts pxsl.to_xslt

Output

<?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' omit-xml-declaration='yes'/>
  <xsl:template match='tree'>
    <entries>
      <summary/>
      <records>
        <xsl:apply-templates select='item'/>
      </records>
    </entries>
  </xsl:template>
  <xsl:template match='item'>
    <entry>
      <summary>
        <xsl:element name='title'>
          <xsl:value-of select='@title'/>
        </xsl:element>
        <xsl:element name='qty'>
          <xsl:value-of select='@qty'/>
        </xsl:element>
      </summary>
      <records/>
    </entry>
  </xsl:template>
</xsl:stylesheet>

Resources

xslt polyrex_xslt gem polyrex