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. thanks! wkr www.turnguard.com ----- 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> <skos:subjectIndicator rdf:resource="http://www.nla.gov.au/apais/thesaurus/h tml/R0386.html" /> </skos:Concept> 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" rdf:resource="http://www.nla.gov.au/apa is/thesaurus/html/R0386.html"/> </skos:Concept> t:\ftemp>type jurgen.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="*[not(@xml:lang)]"> <xsl:copy> <xsl:attribute name="xml:lang">en</xsl:attribute> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> t:\ftemp> -- 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, G. Ken Holman | Thread | RE: [xsl] Change xml:lang of a skos, Michael Kay |
Re: [xsl] De Normalize XML using XS, G. Ken Holman | Date | Re: [xsl] De Normalize XML using XS, Senthilukvelaan |
Month |