next
|
Subject: Yet another problem Author: Kalyan Tummala Date: 02 Apr 2008 03:04 PM
|
Hi all
I had a problem earlier and it was solved. I have another one now. Here it is
In the XML file given below I have 2 nodes namely "address/name" and "address/campus/name". Both are mutually exclusive. I mean if there is a value in address/name there wont be any value in address/campus/name
But I need to get all of these values under one coloumn in my CSV sheet.
So here was the code I wrote in my XSL
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:variable name="separator" select="','"/>
<xsl:value-of select="concat('AicID', $separator, 'PROGRAMID', $separator, 'PROGTITLE', $separator, 'PROGLOC', $separator, 'LOCATION', $separator, 'PROGADDR', $separator, 'CITY', $separator, 'STATE', $separator, 'ZIP', $separator, 'UPDATEDATE', $separator, 'PROGURL', $separator, 'IMPACTAREA', $separator, 'LONGITUDE', $separator, 'LATITUDE' )"/><xsl:text>
</xsl:text>
<xsl:variable name="quot" select="'"'"/>
<xsl:for-each select="xmlServiceResponse/body/searchResults/programLocation">
<xsl:value-of select="concat(position(), $separator, programSeries/@uid, $separator, $quot, title, $quot, $separator, address/@uid, $separator, $quot, ADDRESS/NAME | ADDRESS/CAMPUS/NAME, $quot, $separator, address/buildingNumber, $separator, address/city, $separator, address/state, $separator, address/postalCode, $separator, @momentModified, $separator, url, $separator, primaryImpactArea/impactArea/name, $separator, address/geoposition/@longitude, $separator, address/geoposition/@latitude)"/><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
(Required code put in caps)
My problem is that, in my CSV sheet I get only the values of "address/name" and the rows that are supposed to have the "address/campus/name" are remaining empty.
Could some one direct me on how to get that. Help will be greatly appreciated.
abc(2).xml A big XML file
|
|