[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,
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|