Page 1 of 1

PRB Convert XML FILE

Posted: Wed Mar 05, 2014 10:14 am
by Le Basque
Hi,

I have an XML file :

Code: Select all


<personnes>
<personne>
<name>XXXX</name>
<adress>YYYYY<nl/>ZZZZZZ<nl/>AAAAA</adress>
</personne>
</personnes>
I want to get (I want to make a table)
...
<row>
<entry rowsep="0" align="left"><para><p>XXXX</p></para></entry>
<entry>
<para><p>YYYYY</p></para>
<para><p>ZZZZZZ</p></para>
<para><p>AAAAA</p></para>
</entry>
</row>
...
My XSLT code :

Code: Select all


<xsl:template match="personne">	
<row><xsl:apply-templates /></row>
</xsl:template>
<xsl:template match="name">
<entry rowsep="0" align="left">
<para><p><xsl:value-of select="."/></p></para>
</entry>
</xsl:template>
<xsl:template match="adress">
<entry>
<para><p><xsl:value-of select="."/></p></para>
<xsl:apply-templates />
</entry>
</xsl:template>
<xsl:template match="nl">
<xsl:text></p></para><para><p></xsl:text>
</xsl:template>
thank you for help

Re: PRB Convert XML FILE

Posted: Wed Mar 05, 2014 10:30 am
by Le Basque
My result is not OK i obtains

Code: Select all


...
<row>
<entry rowsep="0" align="left"><para><p>XXXX</p></para></entry>
<entry>
<para><p>YYYYY ZZZZZZ AAAAA</p></para>
</entry>
</row>
...

Re: PRB Convert XML FILE

Posted: Wed Mar 05, 2014 1:05 pm
by adrian
Hi,

I've changed the address template to use each individual text node and just ignored the separating element (nl).

Code: Select all


    <xsl:template match="adress">
<entry>
<xsl:for-each select="text()">
<para><p><xsl:value-of select="."/></p></para>
</xsl:for-each>
</entry>
</xsl:template>
Regards,
Adrian

Re: PRB Convert XML FILE

Posted: Wed Mar 05, 2014 1:26 pm
by Le Basque
Thank you is ok

best regards