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.
opeNote[not(@xml:lang)]">based on the first answer from ken, i'm doing the following which does exactly what i want ... <xsl:template match="skos:prefLabel|skos:altLabel|skos:hiddenLabel|skos:definition|skos:sc
The way you've written the above implies a distributive property that does not exist ... to get what you are expressing you would need:
match="skos:prefLabel[not(@xml:lang)]| skos:altLabel[not(@xml:lang)]| skos:hiddenLabel[not(@xml:lang)]| skos:definition[not(@xml:lang)]| skos:scopeNote[not(@xml:lang)]"
match="skos:prefLabel| skos:altLabel| skos:hiddenLabel| skos:definition| skos:scopeNote"
<xsl: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).
-- 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? http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Change xml:lang of a skos, Jürgen Jakobitsch | Thread | Re: [xsl] Change xml:lang of a skos, Jürgen Jakobitsch |
RE: [xsl] How to find out the lowes, Michael Kay | Date | Re: [xsl] Change xml:lang of a skos, Jürgen Jakobitsch |
Month |