You could also combine the best of both solutions with:
<xsl:for-each select="//dc:subject">
<tr>
<td scope="col" class="width1"/>
<th scope="col" class="width20">Subject</th>
<xsl:if test="@xsi:type">
<xsl:text> (</xsl:text)
<xsl:value-of select="substring-after(@xsi:type, ':')"/>
<xsl:text>)</xsl:text>
</xsl:if>
<xsl:text>: </xsl:text>
<td scope="col" class="widthAuto">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:for-each>
...which would allow for the addition of other controlled subject
vocabularies (or none at all) without having to update your stylesheet.
-----
Shawn Averkamp
Metadata Librarian
University of Alabama Libraries
[log in to unmask]
On Mon, Aug 1, 2011 at 6:03 PM, Enrico Silterra <[log in to unmask]> wrote:
> something like
> <xsl:for-each select="//dc:subject">
> > <tr>
> > <td scope="col" class="width1"/>
> >
> <xsl:choose>
> <xsl:when test="@xsi:type='dcterms:LCSH'">
> <th scope="col" class="width20">Subject: LCSH </th>
> </xsl:when>
> <xsl:when test="@xsi:type='dcterms:TGM'>
> <th scope="col" class="width20">Subject: TGM</th>
> </xsl:when>
> </xsl:choose>
>
> > <td scope="col" class="widthAuto"><xsl:value-of select="." />
> > </td>
> > </tr>
> "
> On Mon, Aug 1, 2011 at 5:54 PM, Edward M. Corrado <[log in to unmask]>
> wrote:
> > Hi,
> >
> > I am trying to do something with an xsl stylesheet (1.0) that seems
> > like it should be pretty simple, but I can't figure out how to do it
> > or find any examples on the Web that work-. I have a set of Dublin
> > Core XML records that have the subjects as either LCSH or TGM. The
> > type of subject is identified by xsi:type. So for an individual
> > record, the subjects may look something like this:
> >
> > <dc:subject xsi:type="dcterms:LCSH">Drum--Kurdistan</dc:subject>
> > <dc:subject xsi:type="dcterms:TGM">Drums (Musical
> > instruments)--Kurds</dc:subject>
> >
> > I want this to display something like:
> >
> > Subject (LCSH): Drum--Kurdistan
> > Subject (TGM): Drums (Musical instruments)--Kurds
> >
> >
> > The following works fine to print the subjects (as part of an HTML
> > table) but (obviously) does not take into account the type of subject
> > heading:
> >
> > <xsl:for-each select="//dc:subject">
> > <tr>
> > <td scope="col" class="width1"/>
> > <th scope="col" class="width20">Subject: </th>
> > <td scope="col" class="widthAuto"><xsl:value-of select="." />
> > </td>
> > </tr>
> > </xsl:for-each>
> >
> > I need some sort of logic to test what the value of xsi:type is but
> > I'm lost. I have been trying to find examples on how to do this on th
> > Web and in a few XSLT books we have in the library with no luck. Any
> > ideas?
> >
> > Edward
> >
>
>
>
> --
> Enrico Silterra Software Engineer
> 501 Olin Library Cornell University Ithaca NY 14853
> Voice: 607-255-6851 Fax: 607-255-6110 E-mail: [log in to unmask]
> http://www.library.cornell.edu/dlit
> "Out of the crooked timber of humanity no straight thing was ever made"
> CONFIDENTIALITY NOTE
> The information transmitted, including attachments, is intended only
> for the person or entity to which it is addressed and may contain
> confidential and/or privileged material. Any review, retransmission,
> dissemination or other use of, or taking of any action in reliance
> upon, this information by persons or entities other than the intended
> recipient is prohibited. If you received this in error, please contact
> the sender and destroy any copies of this document.
>
|