Jump to content

Facing Issue in XSLT format


vishu16.vishwas@gmail.com
 Share

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
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...