Jump to content

Amyla

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Amyla

  • Rank
    Newbie
  1. Hi all, I need help with this xml file: <?xml version="1.0" encoding="ISO-8859-1"?> <output> <orders> <order> <id>1</id> <number>10002</number> <type>Loading</type> <date>2013-01-01T02:30:00</date> </order> <order> <id>2</id> <number>10003</number> <type>Loading</type> <date>2013-01-01T010:30:00</date> </order> <order> <id>3</id> <number>10004</number> <type>Loaded</type> <date>2013-01-01T12:30:00</date> </order> </orders> <quantities> <quantity> <id_order>1</id_order> <unit>KG</unit> <value>1000</value> </quantity> <quantity> <id_order>1</id_order> <unit>PAL</unit> <value>3</value> </quantity> <quantity> <id_order>1</id_order> <unit>M3</unit> <value>1.5</value> </quantity> <quantity> <id_order>2</id_order> <unit>KG</unit> <value>2000</value> </quantity> <quantity> <id_order>2</id_order> <unit>PAL</unit> <value>4</value> </quantity> <quantity> <id_order>3</id_order> <unit>KG</unit> <value>5000</value> </quantity> </quantities> </output> i need to add an extra tag <hour> after >date> nd in this new tg put te value of time (hh:mm) find in date. I've managed to do this (but it only create the tag and don't put th hours in it) <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="date"> <xsl:copy-of select="."/> <hour> <xsl:value-of select="substring(output/orders/order/date,12,5)"/> </hour> </xsl:template> </xsl:stylesheet> please help me
×
×
  • Create New...