Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Nesting

From: jjjlda@-------.--- (------)
To: NULL
Date: 5/3/2004 3:24:00 PM
I am a bit of a novice and am running into trouble when trying to
create the xsl file to format my xml document.  My xml document is of
the form:

<articles>
<publication>
<title>Title</title>
<filename>/dir/filename.txt</filename>
<authors>Author</authors>
<source>Source</source><date>Date</date>
</publication>
<articles>

I want the data to be formatted as follows at the end:

<table>
<tr><td><a href="/dir/filename.txt">Title</a></td></tr>
<tr><td>Author</td></tr>
<tr><td>Source</td></tr>
<tr><td>Date</td></tr>
</table>

I have come up with the following xsl file, but I cannot get the href
to work because it requires me to nest tags.  I realzie the formatting
is a bit different, but this should be irrelevant.

<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:template match="articles">
    <html><head><title><xsl:text>Reference</xsl:text></title></head>
	<body>
	  <h1><xsl:text>Articles</xsl:text></h1>
	  <table border="0" cellpadding="2" cellspacing="2">
	   <xsl:apply-templates/>
	  </table>
	</body>
    </html>
  </xsl:template>

  <xsl:template match="publication">
    <tr>
      <td><b><a href="child::filename"><xsl:value-of
select="title"/></a></b></td>
    </tr>
    <tr>
      <td><xsl:value-of select="authors"/></td>
    </tr>
    <tr>
      <td><xsl:value-of select="source"/><xsl:text>,
</xsl:text><xsl:value-of select="date"/></td>
    </tr>
    <tr>
      <td colspan="3"><br></br></td>
    </tr>
  </xsl:template>

</xsl:stylesheet>

Can someone please help a novice out?

Thanks!


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent