Subject: [xsl] XML to CSV columns problem From: Byomokesh Sahoo <sahoo.byomokesh@xxxxxxxxx> Date: Mon, 20 Apr 2009 15:13:45 +0530 |
Hi All, I am writing one xslt to convert xml to csv. My problem is Data is not coming proper column wise. Some data is coming extra tag (compare two products). XML ==== <Product> <RecordReference>9780316002769</RecordReference> <NotificationType>03</NotificationType> <ProductIdentifier> <ProductIDType>02</ProductIDType> <IDValue>0316002763</IDValue> </ProductIdentifier> <ProductIdentifier> <ProductIDType>03</ProductIDType> <IDValue>9780316002769</IDValue> </ProductIdentifier> <ProductIdentifier> <ProductIDType>15</ProductIDType> <IDValue>9780316002769</IDValue> </ProductIdentifier> <ProductIdentifier> <ProductIDType>14</ProductIDType> <IDValue>09780316002769</IDValue> </ProductIdentifier> <ProductForm>DG</ProductForm> <EpubType>027</EpubType> <Series> <TitleOfSeries/> <NumberWithinSeries/> </Series> <Title textcase="02"> <TitleType>01</TitleType> <TitleText>A Perfect Mess</TitleText> <Subtitle>The Hidden Benefits of Disorder</Subtitle> </Title> <Contributor> <ContributorRole>A01</ContributorRole> <PersonNameInverted>Abrahamson, Eric</PersonNameInverted> </Contributor> <Contributor> <ContributorRole>A01</ContributorRole> <PersonNameInverted>Freedman, David H.</PersonNameInverted> </Contributor> <EditionTypeCode/> <EditionNumber/> <Language> <LanguageRole>01</LanguageRole> <LanguageCode>eng</LanguageCode> </Language> <BASICMainSubject>SEL000000</BASICMainSubject> <AudienceCode>01</AudienceCode> <OtherText> <TextTypeCode>01</TextTypeCode> <Text textformat="02">"That moderately messy systems use resources more efficiently, yield better solutions, and are harder to break than neat ones.</Text> </OtherText> <Imprint> <NameCodeType>02</NameCodeType> <NameCodeValue>110101</NameCodeValue> <ImprintName>Little, Brown and Company</ImprintName> </Imprint> <Publisher> <PublishingRole>01</PublishingRole> <NameCodeType>02</NameCodeType> <NameCodeValue>Little, Brown And Company</NameCodeValue> <PublisherName>Little, Brown And Company</PublisherName> </Publisher> <PublishingStatus>04</PublishingStatus> <PublicationDate>20070101</PublicationDate> <SalesRights> <SalesRightsType>01</SalesRightsType> <RightsCountry>CA PH PR UM US VI</RightsCountry> </SalesRights> <RelatedProduct> <RelationCode>13</RelationCode> <ProductIdentifier> <ProductIDType>02</ProductIDType> <IDValue>0316114758</IDValue> </ProductIdentifier> </RelatedProduct> <SupplyDetail> <SupplierSAN>2002205</SupplierSAN> <SupplierName>Hachette Book Group USA</SupplierName> <ReturnsCodeType>02</ReturnsCodeType> <ReturnsCode>Y</ReturnsCode> <AvailabilityCode>IP</AvailabilityCode> <ProductAvailability>20</ProductAvailability> <PackQuantity>1</PackQuantity> <Price> <PriceTypeCode>01</PriceTypeCode> <DiscountCoded> <DiscountCodeType>02</DiscountCodeType> <DiscountCodeTypeName>HBGUSA</DiscountCodeTypeName> <DiscountCode>XI</DiscountCode> </DiscountCoded> <PriceAmount>14.99</PriceAmount> <CurrencyCode>USD</CurrencyCode> </Price> </SupplyDetail> </Product> <Product> <RecordReference>9780316002790</RecordReference> <NotificationType>03</NotificationType> <ProductIdentifier> <ProductIDType>02</ProductIDType> <IDValue>0316002798</IDValue> </ProductIdentifier> <ProductIdentifier> <ProductIDType>03</ProductIDType> <IDValue>9780316002790</IDValue> </ProductIdentifier> <ProductIdentifier> <ProductIDType>15</ProductIDType> <IDValue>9780316002790</IDValue> </ProductIdentifier> <ProductIdentifier> <ProductIDType>14</ProductIDType> <IDValue>09780316002790</IDValue> </ProductIdentifier> <ProductForm>DG</ProductForm> <EpubType>027</EpubType> <Series> <TitleOfSeries/> <NumberWithinSeries/> </Series> <Title textcase="02"> <TitleType>01</TitleType> <TitleText>Step on a Crack</TitleText> </Title> <Contributor> <ContributorRole>A01</ContributorRole> <PersonNameInverted>Patterson, James</PersonNameInverted> </Contributor> <Contributor> <ContributorRole>A01</ContributorRole> <PersonNameInverted>Ledwidge, Michael</PersonNameInverted> </Contributor> <EditionTypeCode/> <EditionNumber/> <Language> <LanguageRole>01</LanguageRole> <LanguageCode>eng</LanguageCode> </Language> <BASICMainSubject>FIC000000</BASICMainSubject> <Subject> <SubjectSchemeIdentifier>10</SubjectSchemeIdentifier> <SubjectCode>FIC030000</SubjectCode> </Subject> <Subject> <SubjectSchemeIdentifier>10</SubjectSchemeIdentifier> <SubjectCode>FIC031000</SubjectCode> </Subject> <AudienceCode>01</AudienceCode> <Imprint> <NameCodeType>02</NameCodeType> <NameCodeValue>110101</NameCodeValue> <ImprintName>Little, Brown and Company</ImprintName> </Imprint> <Publisher> <PublishingRole>01</PublishingRole> <NameCodeType>02</NameCodeType> <NameCodeValue>Little, Brown And Company</NameCodeValue> <PublisherName>Little, Brown And Company</PublisherName> </Publisher> <PublishingStatus>04</PublishingStatus> <PublicationDate>20070206</PublicationDate> <SalesRights> <SalesRightsType>01</SalesRightsType> <RightsCountry>CA PH PR UM US VI</RightsCountry> </SalesRights> <RelatedProduct> <RelationCode>13</RelationCode> <ProductIdentifier> <ProductIDType>02</ProductIDType> <IDValue>0316013943</IDValue> </ProductIdentifier> </RelatedProduct> <SupplyDetail> <SupplierSAN>2002205</SupplierSAN> <SupplierName>Hachette Book Group USA</SupplierName> <ReturnsCodeType>02</ReturnsCodeType> <ReturnsCode>Y</ReturnsCode> <AvailabilityCode>IP</AvailabilityCode> <ProductAvailability>20</ProductAvailability> <PackQuantity>1</PackQuantity> <Price> <PriceTypeCode>01</PriceTypeCode> <DiscountCoded> <DiscountCodeType>02</DiscountCodeType> <DiscountCodeTypeName>HBGUSA</DiscountCodeTypeName> <DiscountCode>XI</DiscountCode> </DiscountCoded> <PriceAmount>9.99</PriceAmount> <CurrencyCode>USD</CurrencyCode> </Price> </SupplyDetail> </Product> XSL ==== <xsl:template match="<!-- apply all tags -->"> <!-- remove normalize-space() if you want keep white-space at it is --> <xsl:value-of select="concat($quote, normalize-space(.), $quote)" /> <xsl:value-of select="$delim" /> </xsl:template> Please provide solution for this scenario. Thanks Byomokesh
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] schema reference in outpu, David Carlisle | Thread | Re: [xsl] XML to CSV columns proble, Michael Ludwig |
Re: [xsl] schema reference in outpu, David Carlisle | Date | Re: [xsl] XML to CSV columns proble, Michael Ludwig |
Month |