homepage Welcome to WebmasterWorld Guest from 54.161.214.221
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
help on xslt
anybody can help me on the xslt for processing xml file
sleepyy




msg:4320323
 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>

 

httpwebwitch




msg:4328812
 3:52 pm on Jun 21, 2011 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved