Initial commit
This commit is contained in:
6
xslt/htmlToEscPos.xslt
Normal file
6
xslt/htmlToEscPos.xslt
Normal file
@@ -0,0 +1,6 @@
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="xml" omit-xml-declaration="yes" />
|
||||
<xsl:template match="/">
|
||||
<xsl:for-each select="table/tbody/tr">\n<xsl:value-of select="td[2]" />x <xsl:value-of select="td[3]" />\n</xsl:for-each>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
38
xslt/orderHtmltoXML.xslt
Normal file
38
xslt/orderHtmltoXML.xslt
Normal file
@@ -0,0 +1,38 @@
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
|
||||
<!-- root - kick things off -->
|
||||
<xsl:template match="/">
|
||||
<order clerk="{table/@data-clerk}">
|
||||
<xsl:apply-templates select='table/tbody/tr[@class = "itemRow"]' mode='item'/>
|
||||
</order>
|
||||
</xsl:template>
|
||||
|
||||
<!-- iteration item - item -->
|
||||
<xsl:template match='tr' mode='item'>
|
||||
<item type="item" split="0">
|
||||
<id><xsl:value-of select="td[contains(@class, 'idCell')]" /></id>
|
||||
<quantity><xsl:value-of select="td[contains(@class,'qtyCell')]" /></quantity>
|
||||
<name><xsl:value-of select="td[contains(@class, 'itemCell')]/a[contains(@class, 'itemText')]" /></name>
|
||||
<unitprice><xsl:value-of select="td[contains(@class,'unitPriceCell')]" /> </unitprice>
|
||||
<totalprice><xsl:value-of select="td[contains(@class,'totalPriceCell')]" /> </totalprice>
|
||||
<printgroup><xsl:value-of select="td[contains(@class,'printGroupCell')]" /></printgroup>
|
||||
<cover><xsl:value-of select="td[contains(@class,'coverCell')]" /></cover>
|
||||
<category><xsl:value-of select="td[contains(@class,'categoryCell')]" /></category>
|
||||
<department><xsl:value-of select="td[contains(@class,'departmentCell')]" /></department>
|
||||
<originalqty><xsl:value-of select="td[contains(@class,'qtyCell')]" /></originalqty>
|
||||
<originaltotalprice><xsl:value-of select="td[contains(@class,'totalPriceCell')]" /></originaltotalprice>
|
||||
<xsl:apply-templates select='following-sibling::tr[@class = "instructionRow" and preceding-sibling::tr[@class = "itemRow"][1] = current()]' mode='instruction'/>
|
||||
</item>
|
||||
</xsl:template>
|
||||
|
||||
<!-- iteration item - instruction -->
|
||||
<xsl:template match='tr' mode='instruction'>
|
||||
<instruction split="0">
|
||||
<id><xsl:value-of select="td[contains(@class,'idCell')]" /></id>
|
||||
<name><xsl:value-of select="td[contains(@class, 'itemCell')]/a[contains(@class, 'itemText')]" /> </name>
|
||||
<unitprice><xsl:value-of select="td[contains(@class,'unitPriceCell')]" /> </unitprice>
|
||||
<originalqty><xsl:value-of select="td[contains(@class,'qtyCell')]" /></originalqty>
|
||||
<originaltotalprice><xsl:value-of select="td[contains(@class,'totalPriceCell')]" /></originaltotalprice>
|
||||
</instruction>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
44
xslt/orderXMLtoHTML.xslt
Normal file
44
xslt/orderXMLtoHTML.xslt
Normal file
@@ -0,0 +1,44 @@
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates mode='item'/>
|
||||
</xsl:template>
|
||||
<xsl:template match='item' mode='item'>
|
||||
<tr class="itemRow">
|
||||
<td class="idCell hide"><xsl:value-of select="id" /></td>
|
||||
<td class="quantityCell"><xsl:value-of select="quantity" /></td>
|
||||
<td class="itemCell"><xsl:value-of select="name" /></td>
|
||||
<td class="unitpriceCell hide"><xsl:value-of select="unitprice" /></td>
|
||||
<td class="printGroupCell hide"><xsl:value-of select="printgroup" /></td>
|
||||
<td class="totalpriceCell"><xsl:value-of select="totalprice" /></td>
|
||||
<td class="coverCell hide"><xsl:value-of select="cover" /></td>
|
||||
<td class="clerkCell"><xsl:value-of select="../@clerk" /></td>
|
||||
<td class="originalQtyCell hide"><xsl:value-of select="quantity" /></td>
|
||||
<td class="categoryCell hide"><xsl:value-of select="category" /></td>
|
||||
<td class="departmentCell hide"><xsl:value-of select="department" /></td>
|
||||
<td class="originalTotalPriceCell hide"><xsl:value-of select="originaltotalprice" /></td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="instruction" mode='instruction'/>
|
||||
</xsl:template>
|
||||
<xsl:template match='instruction' mode='instruction'>
|
||||
<tr class="instructionRow">
|
||||
<td class="idCell hide"><xsl:value-of select="id" /></td>
|
||||
<td class="quantityCell invisibleText">1</td>
|
||||
<td class="itemCell"><xsl:value-of select="name" /></td>
|
||||
<td class="unitpriceCell hide"><xsl:value-of select="unitprice" /></td>
|
||||
<td class="printGroupCell hide"></td>
|
||||
<xsl:if test="not(number(unitprice) = '0')">
|
||||
<td class="totalpriceCell"><xsl:value-of select="unitprice" /></td>
|
||||
</xsl:if>
|
||||
<xsl:if test="number(unitprice) = '0'">
|
||||
<td class="totalpriceCell invisibleText"><xsl:value-of select="unitprice" /></td>
|
||||
</xsl:if>
|
||||
<td class="coverCell hide"><xsl:value-of select="../cover" /></td>
|
||||
<td class="clerkCell"><xsl:value-of select="../../@clerk" /></td>
|
||||
<td class="originalQtyCell hide">1</td>
|
||||
<td class="categoryCell hide"><xsl:value-of select="../category" /></td>
|
||||
<td class="departmentCell hide"><xsl:value-of select="../department" /></td>
|
||||
<td class="originalTotalPriceCell hide"><xsl:value-of select="originaltotalprice" /></td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
Reference in New Issue
Block a user