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: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Oct 2009 07:40:58 -0400
You need a slight modification, Jurgen, because
predicates are not distributive across the union
"|" operator as you have written.

But there is an explanation as to why your code works for you.

At 2009-10-15 08:11 +0100, JC<rgen Jakobitsch wrote:
based on the first answer from ken, i'm doing the following
which does exactly what i want

The way you've written the above implies a
distributive property that does not exist ... to
get what you are expressing you would need:


But, in fact, because of the way I wrote the template, you really only need:


Because of the order of the content of the copy:

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

In XSLT/XQuery, when you construct the result tree, you can continuously replace a given attribute as many times as you need up until you begin that attribute's element's content ... at which point you are stuck.

So, in my template rule, I am adding the
xml:lang="en" and then adding all of the input
element's attributes.  If the input element also
has xml:lang= then that will replace the one I
put into the result tree, and you end up getting it preserved.

My use of "*[not(@xml:lang)]" in the original
could have simply been "*", but that would not
have conveyed to the reader that the match is
qualifying only particular elements, not all
elements (in fact it could have been written as
all elements, but then there would be no
catch-all for all elements in the identity template).

I hope this helps.

. . . . . . . . . . . Ken

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