I am trying to write a conditional statement based on an attribute:
The XML doc will have either @level=series, subseries, file, item, or no
attribute.
I would like the output to be in <p> with default font where
@level="series" | @level="subseries"
and <font size="-1" color="gray"> where there is file, item or no level
attribute. In other words anything but series or subseries.
Here are two examples of XML:
scopecontent is the element i am trying to format. parent element is dsc.
<c01 level="series">
<did>
<container type="folder" label="Folder"> 15</container>
<unittitle><unitdate>1932</unitdate></unittitle>
</did>
<scopecontent>
<p> Includes letters regarding Lee Strasberg's health. </p>
</scopecontent>
<c04>
<did>
<container type="folder" label="Folder"> 15</container>
<unittitle><unitdate>1932</unitdate></unittitle>
</did>
<scopecontent>
<p> Includes letters regarding Lee Strasberg's health. </p>
</scopecontent>
</c04>
I tried the following with no luck:
<xsl:template match='dsc//scopecontent'>
<xsl:choose>
<xsl:when test='* [(_at_)level="series"] |
* [(_at_)level="subseries"]'>
<p>
<xsl:apply-templates/>
</p>
</xsl:when>
<xsl:otherwise>
<font size="-1" color="gray">
<xsl:apply-templates/>
</font>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Also:
<xsl:template match='* [(_at_)level="series"]//scopecontent |
* [(_at_)level="subseries"]//scopecontent'>
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match='* [not (@level="series")]//scopecontent |
* [not (@level="subseries")]//scopecontent'>
<font size="-1" color="gray">
<xsl:apply-templates/>
</font>
</xsl:template>
Thanks for the help.
Lynn
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--