Jump to content
Sign in to follow this  
vishu16.vishwas@gmail.com

Facing Issue in XSLT format

Recommended Posts

Hi Anyone,

It will be great if any one can help me to format my xslt in table format.

I am given my below xslt and input xml also.

 

Input xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<L7j:jdbcQueryResult xmlns:L7j="http://ns.l7tech.com/2012/08/jdbc-query-result">
<L7j:row>
<L7j:col name="name" type="java.lang.String">Policy for service #0b8bab6913cc588557b6973e94d1bfdd, WSTrustSoapService</L7j:col>
<L7j:col name="comment" ><![CDATA[NULL]]></L7j:col><L7j:col name="version" type="java.lang.Integer">18</L7j:col></L7j:row>
<L7j:row><L7j:col name="name" type="java.lang.String">Policy for service #0b8bab6913cc588557b6973e94d5893d, UUPRStub</L7j:col><L7j:col name="comment" ><![CDATA[NULL]]></L7j:col><L7j:col name="version" type="java.lang.Integer">16</L7j:col></L7j:row><L7j:row><L7j:col name="name" type="java.lang.String">Policy for service #0b8bab6913cc588557b6973e94d7900f, smstest</L7j:col><L7j:col name="comment" ><![CDATA[NULL]]></L7j:col><L7j:col name="version" type="java.lang.Integer">6</L7j:col></L7j:row>
</L7j:jdbcQueryResult>
XSLT Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Name</th>
<th>Comment</th>
<th>Version</th>
</tr>
<xsl:for-each select="L7j:jdbcQueryResult/L7j:row/L7j:col">
<tr>
<xsl:if test="@name ='name'">
<td><xsl:value-of select="."/></td>
</xsl:if>
<xsl:if test="@name ='comment'">
<td><xsl:value-of select="."/></td>
</xsl:if>
<xsl:if test="@name ='version'">
<td><xsl:value-of select="."/></td>
</xsl:if>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
which give not correct format..
I want the format in below manner
Name comment version
----------------------------------------
test test123 23

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...