Amy,
Using for-each is problematic.
EAD has a nice heirarchy so why not just use it.
Apply templates will work on any existing node you want.
I would suggest you re-think your unittitle template. What if you
have children like <emph>? I would use apply-templates in the
unittitle template instead of value-of. If you use value-of you will
get all the text without any children. If you use apply-templates you
will get all the children but you will need to write templates for
any possible children.
(code below)
Mike Ferrando
Library Technician
Library of Congress
Washington, DC
202-707=4454
<xsl:template match="dsc">
<xsl:apply-templates select="c01"/>
</xsl:template>
<xsl:template match="c01">
<!-- transform into HTML your scopecontent, etc. here -->
<xsl:if test="child::c02/did/unittitle">
<table>
<tr>
<th>Folder Title</th>
<th>Folder Date Range</th>
<th>Box Number</th>
<th>Folder Number</th>
</tr>
<xsl:apply-templates select="c02"/>
</table>
</xsl:if>
</xsl:template>
<xsl:template match="c02">
<tr>
<xsl:apply-templates select="did"/>
</tr>
<!-- assuming that there are no c03 children -->
</xsl:template>
<xsl:template match="did">
<xsl:apply-templates select="unittitle"/>
<xsl:apply-templates select="unitdate"/>
<xsl:apply-templates select="container"/>
</xsl:template>
<xsl:template match="container">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
<xsl:template match="unittitle">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
<xsl:template match="unitdate">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
--- Amy Stout <[log in to unmask]> wrote:
> Hi,
>
> I'm having a for-each problem. In this case, the XML looks
> fine, but the XSLT is not picking up the data. I tried
> adding the <tbody> tag but it didn't help. My XSLT code
> looks like this:
>
> **************************
>
> <table border="1" cellpadding="5">
>
> <tr>
> <th>Folder Title</th>
> <th>Folder Date Range</th>
> <th>Box Number</th>
> <th>Folder Number</th>
> </tr>
>
> <xsl:for-each select="unittitle">
> <tr>
> <td><xsl:value-of
> select="c01/c02/did/unittitle"/></td>
> <td><xsl:value-of
> select="c01/c02/did/unitdate"/></td>
> <td><xsl:value-of
> select="c01/c02/did/container[1]"/></td>
> <td><xsl:value-of
> select="c01/c02/did/container[2]"/></td>
> </tr>
> </xsl:for-each>
>
> </table>
>
> ******************************
>
> I would appreciate any help!
>
> Thank you,
> Amy
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|