[xsl] Create XML

Subject: [xsl] Create XML
From: IZASKUN GUTIERREZ GUTIERREZ <igutierrez027@xxxxxxxxxxxxx>
Date: Thu, 17 Apr 2008 11:55:27 +0200
Hello!

I am using this stylesheet.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
    xmlns:owl="http://www.w3.org/2002/07/owl#"; >

    <!--Esta plantilla me dice si es clase, datatypeProperty o
objectproperty-->

<xsl:output method="xml" indent="yes"/>

<xsl:param name="clase">Article</xsl:param>

<xsl:template match="rdf:RDF/rdf:Description" name="first">

        <xsl:variable name="var" select="concat('#',$clase)"/>
        <xsl:variable name="var2" select="concat('/',$clase)"/>
        <xsl:if test="ends-with(@rdf:about,$var) or
ends-with(@rdf:about,$var2)">
            <xsl:if test="
rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#Class'    ">
                <!-- guardo en el parametro this_is que es Class -->
                <xsl:call-template name="second">
                    <xsl:with-param name="this_is"  select=" 'Class'  "/>
                </xsl:call-template>
            </xsl:if>

            <xsl:if
test="rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#ObjectProperty'
or

rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#TransitiveProperty'
or

rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#FunctionalProperty'
or

rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#InverseFunctionalProper
ty'
or

rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#SymmetricProperty'
or

rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#AnnotationProperty'
">
                <!-- guardo en el parametro this_is que es ObjectProperty
-->
                <xsl:call-template name="second">
                    <xsl:with-param name="this_is"  select="
'ObjectProperty' "/>
                </xsl:call-template>
            </xsl:if>

            <xsl:if
test="rdf:type/@rdf:resource='http://www.w3.org/2002/07/owl#DatatypeProperty'
">
                <!-- guardo en el parametro this_is que es
DatatypeProperty  -->
                <xsl:call-template name="second">
                    <xsl:with-param name="this_is"  select="
'DatatypeProperty'  "/>
                </xsl:call-template>
               </xsl:if>

        </xsl:if>
    </xsl:template>

    <xsl:template name="second">
        <xsl:param name="this_is"/>
        <xsl:value-of select="$clase"/>
        <xsl:text>
        </xsl:text>
         <xsl:value-of select="$this_is"/>
    </xsl:template>
    </xsl:stylesheet>


In the "second" template depending on the value of the "this_is" param, the result is different. I have problems because i dont know how write the result. In this case like Article is Class I need write in the console

<Article id="abc">
  <author type="string">John Smith</author>
</Article>

The problem is that Article, abc, author , John Smith are params and I
dont Know how create them to write in the console because I must use
the params with
$.

Than you

Izaskun

Current Thread