Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml/xsl to html problem

Status
Not open for further replies.

davefm1

Programmer
Apr 18, 2001
78
US
Hi;
I am using templates and coverting raw xml from asp / xsl to HTML my problem is
I presently have 2 tabels the first table just flows one row at a time for 1 <td>and thats fine . But. my second table has 3 <td> per row and there all bunch up in each row. is there any way to space them apart form one another equally Like...
VoterName Vote Comments
xxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxxx
Is there away to do this in XSLT
Ive try the following in my XSL is three some thing wrong.
Any Help would be appreciated.

<?xml version=&quot;1.0&quot;?>

<xsl:stylesheet xmlns:xsl=&quot; version=&quot;1.0&quot;>

<xsl:eek:utput omit-xml-declaration=&quot;yes&quot;/>

<xsl:template match=&quot;/&quot;>
<html>
<body>
<table valign=&quot;top&quot;>

<xsl:apply-templates select=&quot;ARTICLES&quot; />

</table>
</body>
</html>
</xsl:template>


<xsl:template match=&quot;ARTICLES&quot;>
<xsl:apply-templates select=&quot;ARTICLE&quot; />
</xsl:template>

<xsl:template match=&quot;ARTICLE&quot;>
<xsl:apply-templates select=&quot;title&quot; />
<xsl:apply-templates select=&quot;author&quot; />
<xsl:apply-templates select=&quot;approvedDate&quot; />
<xsl:apply-templates select=&quot;abstract&quot; />
<xsl:apply-templates select=&quot;article&quot; />
<xsl:apply-templates select=&quot;voter&quot; />

</xsl:template>

<xsl:template match=&quot;title&quot;>
<tr>
<xsl:element name=&quot;td&quot;>
<strong>Title: </strong>
<xsl:value-of select=&quot;.&quot;/>
</xsl:element>
</tr>
</xsl:template>

<xsl:template match=&quot;author&quot;>
<tr>
<xsl:element name=&quot;td&quot;>
<strong>Author: </strong>
<xsl:value-of select=&quot;.&quot;/>
</xsl:element>
</tr>
</xsl:template>

<xsl:template match=&quot;approvedDate&quot;>
<tr>
<xsl:element name=&quot;td&quot;>
<xsl:attribute name=&quot;align&quot;>right</xsl:attribute>
<strong>
Approved for release on:
<xsl:value-of select=&quot;.&quot;/>
</strong>
</xsl:element>
</tr>
</xsl:template>

<xsl:template match=&quot;abstract&quot;>
<tr>
<xsl:element name=&quot;td&quot;>
<strong>Abstract: </strong>
<xsl:value-of select=&quot;.&quot;/>
</xsl:element>
</tr>
</xsl:template>

<xsl:template match=&quot;article&quot;>
<tr>
<xsl:element name=&quot;td&quot;>
<strong>Article: </strong>
<xsl:value-of select=&quot;.&quot;/>
</xsl:element>
</tr>

<tr>
<xsl:element name=&quot;td&quot;>
<xsl:attribute name=&quot;align&quot;>center</xsl:attribute>
<strong>HSBR Votes: </strong><hr/>
</xsl:element>
</tr>
</xsl:template>


<xsl:template match=&quot;voter&quot;>
<table cols=&quot;3&quot; >
<COL>
<tr>
<xsl:apply-templates select=&quot;./voterName&quot; />
<xsl:apply-templates select=&quot;./voterVote&quot; />
<xsl:apply-templates select=&quot;./voterNotes&quot; />
</tr>
</COL>
</table>
</xsl:template>



<xsl:template match=&quot;voterName&quot;>
<xsl:element name=&quot;td&quot;>
<!-- <strong>Voter Name: </strong> -->
<xsl:attribute name=&quot;table-cell-width&quot;>4in</xsl:attribute>
<xsl:attribute name=&quot;text-align&quot;>right</xsl:attribute>
<xsl:value-of select=&quot;.&quot;/>
</xsl:element>
</xsl:template>



<xsl:template match=&quot;voterVote&quot;>
<xsl:element name=&quot;td&quot;>
<xsl:attribute name=&quot;align&quot;>right</xsl:attribute>
<strong>Voter Vote: </strong>
<xsl:attribute name=&quot;align&quot;>right</xsl:attribute>
<xsl:value-of select=&quot;.&quot;/>
</xsl:element>
</xsl:template>


<!-- This is the second table. I am try to process these three templates
so that the output
coreasponse to the coreect person need to space td or cols so
data flows like example-->

<xsl:template match=&quot;voterNotes&quot;>
<xsl:element name=&quot;td&quot;>
<xsl:attribute name=&quot;align&quot;>right</xsl:attribute>
<strong>Voter Notes: </strong>
<xsl:value-of select=&quot;.&quot;/>
</xsl:element>
</xsl:template>

</xsl:stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top