Subject: [xsl] Extracting element name and value as separate From: "Thangavelu Srinivasan" <vasantry@xxxxxxxxx> Date: Fri, 16 Feb 2007 17:49:57 +0530 |
I am using xslt 1.0. I am facing the problem in extracting the element name and value separately. Any suggestions are welcome
<state_results state_name="Atlantic Canada" state_id="AC"> - <game_results game_name="Lotto 6/49" game_id="201"> - <date> <abbr_date>02/03/07</abbr_date> <full_date>02/03/2007</full_date> </date> <number_str>10-13-24-27-37-39, Bonus: 14</number_str> - <numbers> <number>10</number> <number>13</number> </numbers> - <bonus> <bonus_name>Bonus</bonus_name> <bonus_number>14</bonus_number> </bonus> - <next_date> <next_abbr_date>02/07/07</next_abbr_date> <next_full_date>02/07/2007</next_full_date> </next_date> </game_results> <requested_action>ADD</requested_action> </state_results>
My XSL: <xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="state_results"> <xsl:for-each select="@*"> <Name><xsl:value-of select="name()"/></Name> <Value><xsl:value-of select="."/></Value> </xsl:for-each> </xsl:template> </xsl:stylesheet>
<Name>state_name</Name> <Value>Atlantic Canada</Value> <Name>state_id</Name> <Value>AC</Value> <Name>game_name</Name> <Value>Lotto 6/49</Value> <Name>game_id</Name> <Value>201</Value> <Name>abbr_date</Name> <Value>02/03/07</Value> <Name>full_date</Name> <Value>02/03/2007</Value> <Name>number_str</Name> <Value>10-13-24-27-37-39, Bonus: 14</Value> <Name>next_abbr_date</Name> <Value>02/07/07</Value>
Regards Srinivas
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] "fetching" elements by na, Georges Schmitz | Thread | RE: [xsl] Extracting element name a, W Charlton |
Re: [xsl] XHTML html validation, John Steel | Date | Re: [xsl] Flattening characters to , Colin Paul Adams |
Month |