[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Insert elment in XSD

Subject: RE: Insert elment in XSD
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Feb 2008 13:14:28 -0000
RE:  Insert elment in XSD
I would be inclined to change:

   <xsl:element name="element" use-attribute-sets="ns1:definition" />
   <xsl:apply-templates/> 

to
   <xsl:variable name="x" select="xs:element[@name='booktitle']"/>
   <xsl:apply-templates select="$x/preceding-sibling::node()"/>
   <xsl:element name="element" use-attribute-sets="ns1:definition" />
   <xsl:apply-templates select="$x/(.,following-sibling::node())"/> 

Michael Kay
http://www.saxonica.com

> -----Original Message-----
> From: igutierrez027@xxxxxxxxxxxxx 
> [mailto:igutierrez027@xxxxxxxxxxxxx] 
> Sent: 29 February 2008 10:36
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Insert elment in XSD
> 
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.