xsl-list
[Top] [All Lists]

[xsl] XML transformation to RDF with XSLT help

2006-05-02 19:40:52
Hello.
I'm working on a xml transformation to RDF with XSLT help.

I'm totally very new to XSLT. And It's hard and I'm stuck now. I need your help.

Here are xml element representation with three ways.
<gemq:teachingMethods xsi:type='dcterms:URI'>http://purl.org/gem/instance/GEM-TM/#PeerTutoring</gemq:teachingMethods> <gemq:teachingMethods xsi:type='gemq:GEM-TM'>Thematic approach</gemq:teachingMethods>
<gemq:teachingMethods>MultimediaInstruction</gemq:teachingMethods>

I need to transform this to rdf like this
With xsi:type="dcterms:URI"
<rdf:Description>
<gemq:teachingMethods rdf:resource="http://purl.org/gem/instance/GEM-TM/#PeerTutoring"/>
 </rdf:Description>

With xsi:type="gemq:GEM-TM"
<rdf:Description>
<gemq:teachingMethods>
  <gemq:GEM-TM>
    <rdf:value>Thematic approach</rdf:value>
    <rdfs:label>Thematic approach</rdfs:label>
  </gemq:GEM-TM>
</gemq:teachingMethods>
</rdf:Description>

And with just free-text
<rdf:Description>
   <gemq:teachingMethods>MultimediaInstruction</dc:identifier>
 </rdf:Description>

I did xslt with
<xsl:template match="gemq:teachingMethods">
                <xsl:choose>
                        <xsl:when test="contains(@xsi:type, 'dcterms:URI')">
                          <xsl:attribute name="rdf:resource">
                                  <xsl:value-of select="normalize-space(.)"/>
                         </xsl:attribute>
                        </xsl:when>
                        <xsl:when test="not[(_at_)xsi:type]">
                          <xsl:attribute name="rdf:resource">
                                  <xsl:value-of select="normalize-space(.)"/>
                         </xsl:attribute>
                        </xsl:when>
                <xsl:otherwise>
                        <gemq:teachingMethods>
                                        <xsl:value-of 
select="normalize-space(.)"/>
                        </gemq:teachingMethods>
                </xsl:otherwise>
        </xsl:choose>
        </xsl:template>

Could you give me some tips or advice?

I appreciate it.

Thanks a lot,

Best regards,
Oknam



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>