Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <update-this>
- <document name="http://blah">
- <amount>015-39</amount>
- <shipping>US::Ground:0.00</shipping>
- <url>http://www.blah.com/my-spade-clothing-11176/487/878765?dn_hhe=mylist-_-nothing-_-nothing-_-nothing</url>
- <size>11.5 D</size>
- <price>100.00 USD</price>
- <stock>present in stock </stock>
- </document>
- </update-this>
- <?xml version="1.0" encoding="UTF-8"?>
- <document name="http://blah">
- <amount>015-39</amount>
- <shipping>US::Ground:0.00</shipping>
- <url>http://www.blah.com/my-spade-clothing-11176/487/878765?dn_hhe=mylist-_-nothing-_-nothing-_-nothing</url>
- <size>11.5 D</size>
- <price>100.00 USD</price>
- <stock>present in stock </stock>
- <discounted_price>90 USD</discounted_price>
- <increased_price>110 USD</increased_price>
- <my_id>487</my_id>
- <set_id>878765</set_id>
- </document>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="document">
- <xsl:variable name="price" select="substring-before(normalize-space(price),' ')"/>
- <xsl:variable name="currency" select="substring-after(normalize-space(price),' ')"/>
- <xsl:variable name="difference" select="number($price) * .10"/>
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- <discounted_price><xsl:value-of select="concat(format-number($price - $difference,'#,###.00'),' ',$currency)"/></discounted_price>
- <increased_price><xsl:value-of select="concat(format-number($price + $difference,'#,###.00'),' ',$currency)"/></increased_price>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="size_present | size_stock">
- <xsl:copy>
- <xsl:value-of select="translate(., ' ', '')"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement