[xsl] Insert elment in XSD

Subject: [xsl] Insert elment in XSD
From: <igutierrez027@xxxxxxxxxxxxx>
Date: Fri, 29 Feb 2008 11:36:28 +0100 (CET)
Hello everybody!

I need insert one element in an XSD with XSLT 2.0 but in one position
specific. This is the XSD and the stylesheet XSL:


This is my XSD:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified"
  targetNamespace="http://bibtexml.sf.net/";
xmlns:dc="http://purl.org/dc/elements/1.1/";
  xmlns:ns1="http://bibtexml.sf.net/"; version="2.0" >

   <xs:import namespace="http://purl.org/dc/elements/1.1/";
schemaLocation="dc.xsd"/>

   <xs:element name="author" type="xs:string"/>
   <xs:element name="booktitle" type="xs:string"/>

</xs:schema>


This is my XSL:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:ns1="http://bibtexml.sf.net/"; version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/";>

    <xsl:param name="file" as="xs:string">reviewed</xsl:param>

      <xsl:attribute-set name="ns1:definition">
        <xsl:attribute name="name">
            <xsl:value-of select="$file"/>
        </xsl:attribute>
        <xsl:attribute name="type">xs:string</xsl:attribute>
    </xsl:attribute-set>

    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="xs:schema">
        <xsl:copy>
            <xsl:element name="element"
use-attribute-sets="ns1:definition" />
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>


This stylesheet runs well but I need introduce the element in a concret
position under    <xs:element name="booktitle" type="xs:string"/>  like
a child of <xs:schema...> tag.

Any way to do it?

Thank You.

Izaskun

Current Thread