Re: [xsl] Change xml:lang of a skos:prefLabel [ skos, rdf, xml:lang ]

Subject: Re: [xsl] Change xml:lang of a skos:prefLabel [ skos, rdf, xml:lang ]
From: Jürgen Jakobitsch <jakobitschj@xxxxxxxx>
Date: Wed, 14 Oct 2009 21:52:46 +0100 (GMT+01:00)
hi ken,

thank you very much, that's way more than i had expected!

i will work on your sample for refinement, but it even
now does nearly everything i want.



----- Original Message -----
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Wednesday, October 14, 2009 10:38:55 PM GMT +01:00 Amsterdam / Berlin /
Bern / Rome / Stockholm / Vienna
Subject: Re: [xsl] Change xml:lang of a skos:prefLabel [ skos, rdf, xml:lang

At 2009-10-14 21:24 +0100, JCB<rgen Jakobitsch wrote:
>that the application i'm working on requires
>an xml:lang attribute for labels like skos:altLabel or skos:prefLabel.

You'll have to be more specific when adapting my example below.

>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?

Yes, base a solution on the identity template, shown below.

I hope this helps.

. . . . . . . . Ken

t:\ftemp>type jurgen.xml
   <skos:Concept rdf:nodeID="R0386"
                 xmlns:skos="urn:X-skos" xmlns:rdf="urn:X-rdf">
     <skos:altLabel>Economic recession</skos:altLabel>
     <skos:altLabel>Depression, Economic</skos:altLabel>
     <skos:related rdf:nodeID="R0392" />
     <skos:related rdf:nodeID="R0174" />
     <skos:inScheme rdf:nodeID="apais" />
     <skos:related rdf:nodeID="R1419" />
     <skos:altLabel>Recession, Economic</skos:altLabel>
     <skos:prefLabel>Economic depression</skos:prefLabel>
tml/R0386.html" />

t:\ftemp>xslt jurgen.xml jurgen.xsl
<?xml version="1.0"
encoding="utf-8"?><skos:Concept xmlns:skos="urn:X-skos" xmln
s:rdf="urn:X-rdf" xml:lang="en" rdf:nodeID="R0386">
     <skos:altLabel xml:lang="en">Economic recession</skos:altLabel>
     <skos:altLabel xml:lang="en">Depression, Economic</skos:altLabel>
     <skos:related xml:lang="en" rdf:nodeID="R0392"/>
     <skos:related xml:lang="en" rdf:nodeID="R0174"/>
     <skos:inScheme xml:lang="en" rdf:nodeID="apais"/>
     <skos:related xml:lang="en" rdf:nodeID="R1419"/>
     <skos:altLabel xml:lang="en">Recession, Economic</skos:altLabel>
     <skos:prefLabel xml:lang="en">Economic depression</skos:prefLabel>
     <skos:subjectIndicator xml:lang="en"
t:\ftemp>type jurgen.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="";

<xsl:template match="*[not(@xml:lang)]">
     <xsl:attribute name="xml:lang">en</xsl:attribute>
     <xsl:apply-templates select="@*|node()"/>

<xsl:template match="@*|node()"><!--identity for all other nodes-->
     <xsl:apply-templates select="@*|node()"/>



Upcoming: hands-on code list, UBL, XSLT, XQuery and XSL-FO classes
in Copenhagen Denmark and Washington DC USA, October/November 2009
Interested in other classes?
Crane Softwrights Ltd.
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:
Video overview:
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07
Legal business disclaimers:

Current Thread