xsl-list
[Top] [All Lists]

[xsl] Create XML

2008-04-17 02:55:56
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#InverseFunctionalProperty' 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



--~------------------------------------------------------------------
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>