xsl-list
[Top] [All Lists]

[xsl] Insert elment in XSD

2008-02-29 03:36:55
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


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