cancel
Showing results for 
Search instead for 
Did you mean: 

how to map data of multiple bodies in single html file???

amitbhardwaj
Champ in-the-making
Champ in-the-making
hi friends
I have used xsd and xsl to create a webform. I have captured data using the web form, which gave me an HTML and an xml output. While capturing data in the webform which contains multi bodies, it shows data of the first body "only"   in html file.

my xsd files are
=============
?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:nf="http://www.alfresco.org/alfresco/nf"
   targetNamespace="http://www.alfresco.org/alfresco/nf"
   elementFormDefault="qualified">

   <!– defines the form for creating a navigation hierarchy –>
   <xs:element name="Template1">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="Description" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>


my xsl file
============
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:nf="http://www.alfresco.org/alfresco/nf"
   xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
   <xslSmiley Surprisedutput method="html" encoding="UTF-8" indent="yes"
      doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>

   <xslSmiley Tonguereserve-space elements="*"/>

   <xsl:template match="/">
      <table>
                                        <xsl:for-each select="/nf:Template1/nfSmiley Very Happyescription">
          <tr>
         <td colspan="2">
            <xsl:value-of select="/nf:Template1/nfSmiley Very Happyescription" disable-output-escaping="yes"/>
         </td>
          </tr>
                </xsl:for-each>   
        </table>
   </xsl:template>
</xsl:stylesheet>

—————————————————
thanks in advance
Amit
2 REPLIES 2

spillai
Champ in-the-making
Champ in-the-making
hi amit,

Try this out

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:nf="http://www.alfresco.org/alfresco/nf"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
<xslSmiley Surprisedutput method="html" encoding="UTF-8" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>

<xslSmiley Tonguereserve-space elements="*"/>

<xsl:template match="/">
<table>
<xsl:for-each select="/nf:Template1/nfSmiley Very Happyescription">
<tr>
<td colspan="2">
<xsl:value-of select="." disable-output-escaping="yes"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

. (dot) helps to fetch the value of current node.

Hope so this solves your problem.

amitbhardwaj
Champ in-the-making
Champ in-the-making
thanks
sujay

my problem is solved  , thanks to u!!! Smiley Very Happy