Welcome to WebmasterWorld Guest from 54.162.239.134

Forum Moderators: httpwebwitch

Message Too Old, No Replies

help on xslt

anybody can help me on the xslt for processing xml file

     
2:33 am on Jun 1, 2011 (gmt 0)



I am trying to write a xslt to retrieve the "Description" element in the input xml file. However I could not get the array list of the "Description" element. I am a new xslt programer, anybody can help? The input file is:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetAllCodeTableFieldsResponse xmlns="http://www.sample.com/">
<GetAllCodeTableFieldsResult>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="SystemId" type="xs:string" minOccurs="0"/>
<xs:element name="FieldName" type="xs:string" minOccurs="0"/>
<xs:element name="From" type="xs:string" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<SystemId>ECCOLAGAN</SystemId>
<FieldName>ECCOINITIATORCODE</FieldName>
<From>00N</From>
<To>00N</To>
<Description>STRING OF PEARLS/NAD/10/23/01</Description>
</Table>
<Table diffgr:id="Table2" msdata:rowOrder="1">
<SystemId>ECCOLAGAN</SystemId>
<FieldName>ECCOINITIATORCODE</FieldName>
<From>00W</From>
<To>00W</To>
<Description>DIST.2/CAMELOT NEIGHBRHD ASSOC./02-11-02</Description>
</Table>
<Table diffgr:id="Table3" msdata:rowOrder="2">
<SystemId>ECCOLAGAN</SystemId>
<FieldName>ECCOINITIATORCODE</FieldName>
<From>01</From>
<To>01</To>
<Description>COUNCIL DISTRICT 1</Description>
</Table>
</NewDataSet>
</diffgr:diffgram>
</GetAllCodeTableFieldsResult>
</GetAllCodeTableFieldsResponse>
</soap:Body>
</soap:Envelope>


My xslt code is:

<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:san="http://www.sample.com/"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/env:Envelope/env:Body/san:GetAllCodeTableFieldsResponse/GetAllCodeTableFieldsResult">

<EformResult>
<Result array="arrInitiatorCodes">
<xsl:for-each select="diffgr:diffgram/NewDataSet/Table">
<xsl:value-of select="Description"/>
</xsl:for-each>
</Result>
</EformResult>
</xsl:template>
</xsl:stylesheet>
3:52 pm on Jun 21, 2011 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member



the Xpath looks right to me. What tools are you using to debug this?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month