Re: problem in xsl translation to rdf

hi,

IMO, a cleaner solution would be to split the XSL logic into 2 (or more)
templates,
one master template for creating the RDF envelope and several
child-templates for matching the various classes (types) of contents.

for example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:azkno="http://expm.rd.ambl.net/kobject/">
<xsl:output method="xml"/>

<!-- master for the RDF envelope -->
<xsl:template match="/">
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.0/"
         xmlns:dcq="http://purl.org/dc/qualifiers/1.0/"
         xmlns:azkno="http://expm.rd.ambl.net/kobject/">

  <xsl:apply-templates />

</rdf:RDF>
</xsl:template>

<!-- child, for the class "kno" -->
<xsl:template match="azkno:kno">
<rdf:Description>
   <xsl:attribute name="rdf:about">
  <xsl:text>http://expm.rd.ambl.net/kobject/KNO1/</xsl:text>
      <xsl:value-of select="dc:identifier"/>
      <xsl:text>.rdf</xsl:text>
   </xsl:attribute>

</rdf:Description>
</xsl:template>
</xsl:stylesheet>


cheers,
joe

Joachim Peer
Research Assistant
MCM Institute, University of St. Gallen
Blumenbergplatz 9, 9000 St. Gallen, Switzerland
Phone: ++41 (0) 71 224 3441, Fax: ++41 (0) 71 224 2771


                                                                                                                 
                      hgadm@cswebmail.com                                                                        
                      Gesendet von:                An:      www-rdf-interest@w3.org                              
                      www-rdf-interest-req         Kopie:                                                        
                      uest@w3.org                  Thema:   problem in xsl translation to rdf                    
                                                                                                                 
                                                                                                                 
                      20.05.2003 13:04                                                                           
                                                                                                                 
                                                                                                                 





Dear all,

I want to transform XML / DC files into an RDF
structure. Here is a snippet of the the original XML:

*************************************************************************************


<?xml version='1.0' encoding='ISO-8859-1' ?>
<?xml:stylesheet type='text/xsl' href='kno2html.xsl'
version='1.0'?>
<azkno:kno
xmlns:azkno='http://expm.rd.ambl.net/kobject/'
           xmlns:dc='http://purl.org/dc/elements/1.1/'

xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'

xsi:schemaLocation='http://expm.rd.ambl.net/kobject/
azkno.xsd'
           azkno:summary_template_version='1.0'>

<dc:title>title here</dc:title>
<dc:identifier>mch02</dc:identifier>
<dc:creator>...</dc:creator>
...

<dc:description>...</dc:description>
</azkno:kno>

*************************************************************************************


Here is a snippet just to produce the tag
<rdf:Description rdf:about="..."> :

*************************************************************************************


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:azkno="http://expm.rd.ambl.net/kobject/">
<xsl:output method="xml"/>

<xsl:template match="/">

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.0/"
         xmlns:dcq="http://purl.org/dc/qualifiers/1.0/"
         xmlns:azkno="http://expm.rd.ambl.net/kobject/">

<rdf:Description>
   <xsl:attribute name="rdf:about">

<xsl:text>http://expm.rd.ambl.net/kobject/KNO1/</xsl:text>
      <xsl:value-of select="/dc:identifier"/>
      <xsl:text>.rdf</xsl:text>
   </xsl:attribute>

</rdf:Description>
</rdf:RDF>

</xsl:template>

</xsl:stylesheet>

*********************************************************************************************


unfortunately the dc:identifier seems not to be parsed
so the resulting about attribute looks like:

<rdf:Description
rdf:about="http://expm.rd.ambl.net/kobject/KNO1/.rdf">

rather than:
<rdf:Description
rdf:about="http://expm.rd.ambl.net/kobject/KNO1/mch02.rdf">



What am i doing wrong ???

Regards,

Holger

___________________________________________________
The ALL NEW CS2000 from CompuServe
 Better!  Faster! More Powerful!
 250 FREE hours! Sign-on Now!
 http://www.compuserve.com/trycsrv/cs2000/webmail/

Received on Tuesday, 20 May 2003 07:22:25 UTC