[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
No, you need to code that in a more generic way. Something like below should work:
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/imgBook">
<html>
<head>
<title>Sample</title>
</head>
<body>
<table border="1">
<xsl:for-each select="*">
<td>
<xsl:value-of select="name()"/>
</td>
</xsl:for-each>
<xsl:for-each select=".//img">
<xsl:variable name="p" select="position()"/>
<xsl:if test="/imgBook/*/img[$p]">
<xsl:variable name="pos" select="position()"/>
<tr>
<xsl:for-each select="/imgBook/*">
<td>
<xsl:value-of select="img[$pos]/@name"/>
</td>
</xsl:for-each>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:transform>
Shailesh Shinde wrote:
Re: [xsl] XSL formatting
Subject: Re: [xsl] XSL formatting From: George Cristian Bina <george@xxxxxxxxxxxxx> Date: Fri, 23 Dec 2005 18:18:00 +0200 |
No, you need to code that in a more generic way. Something like below should work:
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/imgBook">
<html>
<head>
<title>Sample</title>
</head>
<body>
<table border="1">
<xsl:for-each select="*">
<td>
<xsl:value-of select="name()"/>
</td>
</xsl:for-each>
<xsl:for-each select=".//img">
<xsl:variable name="p" select="position()"/>
<xsl:if test="/imgBook/*/img[$p]">
<xsl:variable name="pos" select="position()"/>
<tr>
<xsl:for-each select="/imgBook/*">
<td>
<xsl:value-of select="img[$pos]/@name"/>
</td>
</xsl:for-each>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:transform>
Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
Shailesh Shinde wrote:
Hi,
What if there are more than two columns, does the below mentioned xsl will
work.
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/imgBook">
<html>
<head>
<title>Sample</title>
</head>
<body>
<table border="1">
<tr>
<td>missing</td>
<td>redundant</td>
<td>c_match</td> <td>sv</td> <td>pn</td> </tr> <xsl:for-each select="missing/img"> <xsl:variable name="pos" select="position()"/> <tr> <td> <xsl:value-of select="@name"/> </td> <td> <xsl:value-of select="../../redundant/img[$pos]/@name"/> </td>
<td> <xsl:value-of select="../../c_match/img[$pos]/@name"/> </td> <td> <xsl:value-of select="../../sv/img[$pos]/@name"/> </td> <td> <xsl:value-of select="../../pn/img[$pos]/@name"/> </td> </tr> </xsl:for-each> <xsl:variable name="mc" select="count(missing/img)"/> What needs to be count for missing?
For other columns below will work just change the column name and add <td/>, is this right?
<xsl:for-each select="redundant/img[position()>$mc]"> <tr> <td/> <td> <xsl:value-of select="@name"/> </td> </tr> </xsl:for-each>
</table> </body> </html> </xsl:template> </xsl:transform>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL formatting, Shailesh Shinde | Thread | RE: [xsl] XSL formatting, Shailesh Shinde |
[xsl] <Xalan:component>, Saini, Amit | Date | Re: [xsl] Tool to process a XSL wit, Dimitre Novatchev |
Month |
Keywords