on 11-12-2013 10:36 AM
Hi guys,
I was planning to output a HTML document from XSLT mapping. I need a table as output.
My input data goes like this:
<items>
<item>
<type>Dog</type>
<name>Fido</name>
</item>
<item>
<type>Person</type>
<name>Bob</name>
</item>
<item>
<type>Plant</type>
<name>Tomato</name>
</item>
<item>
<type>Cat</type>
<name>Garfield</name>
</item>
</items>
I need these details tabulated in an HTML file.
Please let me know what the target data type should be!!
Hello,
Try this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<tr>
<th>Type</th>
<th>Name</th>
</tr>
<xsl:for-each select="//item">
<tr>
<td>
<xsl:value-of select="type"/>
</td>
<td>
<xsl:value-of select="name"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
Thanks. I followed it. I used FILE adapter on the source and target sides. The output file is empty 😐
This is my transformation :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="ITEMS/ITEM">
<table border="2">
<tbody>
<tr>
<th><xsl:value-of select="TYPE"/></th>
<th><xsl:value-of select="NAME"/></th>
</tr>
</tbody>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Hello,
Use this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<table border="2">
<xsl:for-each select="//ITEMS/ITEM">
<tbody>
<tr>
<th>
<xsl:value-of select="TYPE"/>
</th>
<th>
<xsl:value-of select="NAME"/>
</th>
</tr>
</tbody>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Thanks
Amit Srivastava
Hello Meghana,
Yes, that would be interesting. Do you need the HTML as an attachment for an email?
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Meghana,
Go ahead with Amit's example. I have a little curiosity what kind of PI scenario you need a html format, could you share with us why you need this output format?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.