Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


splitting single column data to multiple column with matching some

From: virendra.chandra@-----.---
To: NULL
Date: 3/2/2006 10:35:00 PM
from the following xml i want do display data in 2 columns only those values 
which are answered.
<Field>

            <Answer>5~~6~~8~~9~~10</Answer>

             <Options>

               <Option>

                 <ItemId>5</ItemId>

                 <ItemValue>first first</ItemValue>

               </Option>

               <Option>

                 <ItemId>6</ItemId>

                 <ItemValue>second first</ItemValue>

               </Option>

               <Option>

                 <ItemId>7</ItemId>

                 <ItemValue>third first</ItemValue>

               </Option>

               <Option>

                 <ItemId>8</ItemId>

                 <ItemValue>fourth first</ItemValue>

               </Option>

               <Option>

                 <ItemId>9</ItemId>

                 <ItemValue>fifth first</ItemValue>

               </Option>

               <Option>

                 <ItemId>10</ItemId>

                 <ItemValue>sixth first</ItemValue>

               </Option>

               <Option>

                 <ItemId>11</ItemId>

                 <ItemValue>seventh first</ItemValue>

               </Option>

               <Option>

                 <ItemId>12</ItemId>

                 <ItemValue>eight first</ItemValue>

               </Option>

               <Option>

                 <ItemId>13</ItemId>

                 <ItemValue>ninth first</ItemValue>

               </Option>

             </Options>

           </Field>



i want to display itemvalue in two columns only those itemValue which
are answered.

for the above example

it will print like this

first first          second first

fourth first       fifteh first

sixth first

i wrote a code to gettng this solution.
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" 
xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
<xsl:value-of select="Field"/>
<xsl:variable name="AnsId">
<xsl:value-of select="Answer" />
</xsl:variable>
<xsl:variable name="Record">
	<xsl:for-each select="Options/Option">																
	<xsl:if test="contains($AnsId,ItemId)">
		<item><xsl:value-of select="ItemValue"/></item>
	</xsl:if>
	</xsl:for-each>
	</xsl:variable>																								
<fo:table width="98mm">

<fo:table-column column-width="49mm"/>
<fo:table-column column-width="49mm"/>														
	<fo:table-body>																
		<xsl:for-each select="exsl:node-set($Record)/item">
		<xsl:if test="(position() mod 2)=1">
		<fo:table-row>																
			
			<fo:table-cell text-align="left">																			
	<fo:block  font-family="times new roman" color="#3464AC" font-size="10pt" 
letter-spacing.minimum=".2mm"  wrap-option="wrap"	hyphenate="true" 
width="43mm" padding="1mm">																									
		
			<xsl:value-of select="." />																	
		</fo:block>>
		</fo:table-cell>
		<fo:table-cell>	
	<fo:block font-family="times new roman" color="#3464AC" font-size="10pt"  
letter-spacing.minimum=".2mm" wrap-option="wrap"	hyphenate="true" 
width="45mm">																	
			<xsl:value-of 
select="./following-sibling::exsl:node-set($Record)/item[1]"/>																			
		</fo:block>		
		</fo:table-cell>																	
		</fo:table-row>
		</xsl:if>
	</xsl:for-each>																		
	</fo:table-body>
</fo:table>
</xsl:value-of>

</stylesheet>

but it's not working. because nfop is throwing a exception. due to 
node-set() function. it's not supporting node-set() function.
is there any other solution.


  
-- 
Virendra Chandra
Software Engineer
Glansa Solution,Secunderabad



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent