Dear all,
I have this file:
Code:
<TD>base, altar</TD>
and this other information
here, which looks like this:
Code:
<skos:Concept rdf:about="http://www.eagle-network.eu/voc/objtyp/lod/53">
<skos:prefLabel xml:lang="en">Basis</skos:prefLabel>
<skos:altLabel xml:lang="es">base</skos:altLabel>
<skos:altLabel xml:lang="tr">kaide</skos:altLabel>
<skos:altLabel xml:lang="hu">lábazat</skos:altLabel>
<skos:altLabel xml:lang="es">Pedestal</skos:altLabel>
<skos:altLabel xml:lang="el">βάση (αγάλματος, μνημείου)</skos:altLabel>
<skos:altLabel xml:lang="ru">база</skos:altLabel>
<skos:altLabel xml:lang="ar">قاعدة</skos:altLabel>
<skos:inScheme rdf:resource="http://www.eagle-network.eu/voc/objtyp/"/>
<skos:exactMatch>
<skos:Concept rdf:about="http://www.eagle-network.eu/voc/objtyp/lod/1338">
<skos:prefLabel xml:lang="es">Pedestal (Basa, Base)</skos:prefLabel>
</skos:Concept>
</skos:exactMatch>
<skos:exactMatch>
<skos:Concept rdf:about="http://www.eagle-network.eu/voc/objtyp/lod/1336">
<skos:prefLabel xml:lang="fr">Pidestal</skos:prefLabel>
</skos:Concept>
</skos:exactMatch>
<dct:created>2013-10-01 22:44:21</dct:created>
</skos:Concept>
<skos:Concept rdf:about="http://www.eagle-network.eu/voc/objtyp/lod/34">
<skos:prefLabel xml:lang="de">Grabaltar</skos:prefLabel>
<skos:altLabel xml:lang="en">altar, funerary</skos:altLabel>
<skos:altLabel xml:lang="de">Altar, Grab</skos:altLabel>
<skos:altLabel xml:lang="it">ara sepolcrale</skos:altLabel>
<skos:altLabel xml:lang="la">ara, sepulcrum</skos:altLabel>
<skos:altLabel xml:lang="fr">autel, tombeau</skos:altLabel>
<skos:altLabel xml:lang="hu">sÃroltár</skos:altLabel>
<skos:altLabel xml:lang="el">επιτύμβια στήλη</skos:altLabel>
<skos:altLabel xml:lang="el">επιτύμβιο σήμα</skos:altLabel>
<skos:altLabel xml:lang="ar">مذبح، جنائزي</skos:altLabel>
<skos:inScheme rdf:resource="http://www.eagle-network.eu/voc/objtyp/"/>
<dct:created>2013-10-01 22:44:21</dct:created>
</skos:Concept>
what I want to do is create one element for each of the terms (base and altar), which contains an attribute with the value of the skosConcept in the second, like this:
Code:
<objectType ref="http://www.eagle-network.eu/voc/objtyp/lod/53">base</objectType>
<objectType ref="http://www.eagle-network.eu/voc/objtyp/lod/34"> altar</objectType>
I have tried to tokenize in a variable and then apply the following code (in which I also have to exclude "?" which might be contained in the initial file) to that, but after a lot of attempts, I renounced using tokenize(.,',') and the best I can get is, without tokenize, to match the first term only:
Code:
<objectType>
<xsl:variable name="noquestion">
<xsl:analyze-string select="normalize-space(TD[position()=6])" regex="(\*\s*\w*)\?">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:analyze-string select="." regex="(\w+),\s(\w*)">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:variable name="voc_term">
<xsl:value-of select="document('https://raw.github.com/PietroLiuzzo/epidocupconversion/master/allinone/eagle-vocabulary-object-type.rdf')//skos:prefLabel[lower-case(.)=lower-case($noquestion)]/parent::skos:Concept/@rdf:about"/><xsl:value-of select="document('https://raw.github.com/PietroLiuzzo/epidocupconversion/master/allinone/eagle-vocabulary-object-type.rdf')//skos:altLabel[lower-case(.)=lower-case($noquestion)]/parent::skos:Concept/@rdf:about"/></xsl:variable>
<xsl:if test="$voc_term!=''">
<xsl:attribute name="ref">
<xsl:value-of select="$voc_term"/>
</xsl:attribute></xsl:if>
<xsl:value-of select="normalize-space(TD[position()=6])"/>
</objectType>
and get this:
Code:
<objectType ref="http://www.eagle-network.eu/voc/objtyp/lod/53">base, altar</objectType>
Could somebody please advise me to where my mistake is?
Thank you very much