the application i'm working on requires
an xml:lang attribute for labels like skos:altLabel or skos:prefLabel.
is there a way (for a complete xsl newbie) to add such an
xml:lang attribute to labels that don't have one and leave
the rest of the thesaurus as it is with xsl?
Depending what exactly you mean by "labels like skos:altLabel or
skos:prefLabel", use the modified identity stylesheet pattern:
<xsl:template match="skos:altLabel|skos:prefLabel">
<xsl:copy>
<xsl:attribute name="xml:lang">en</xsl:attribute>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
This relies on the fact that if you add the same attribute to an element
twice, the last one wins.
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
--~------------------------------------------------------------------
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>
--~--