[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Change xml:lang of a skos:prefLabel [ skos, rdf,

Subject: RE: Change xml:lang of a skos:prefLabel [ skos, rdf, xml:lang ]
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 14 Oct 2009 23:19:45 +0100
RE:  Change xml:lang of a skos:prefLabel [ skos
> 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 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.