[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] problem - generating XML schema via XSLT


Subject: Re: [xsl] problem - generating XML schema via XSLT
From: S Woodside <sbwoodside@xxxxxxxxx>
Date: Fri, 3 Oct 2003 15:57:18 -0400

Why not write your schema in Relax NG (RNG) and convert it to W3C XML Schema (WXS) using Trang ? All the work is already done for you ... RNG is MUCH easier to write and read.

http://www.thaiopensource.com/relaxng/trang.html

simon

On Friday, October 3, 2003, at 10:28 AM, Christian Sell wrote:

Hello all,

I am trying to generate an XML schema file from an XML input document, and encounter a somewhat esoteric problem. I am using Xalan 2.5.1. The input document is in essence a simplified version of the schema. Heres an example:

the input:

<library prefix="test">
    <element name="dosome"/>
</library>

should become:

<xs:schema xmlns:xs="..." xmlns="test" targetNamespace="test">
    <xs:element name=dosome type="ElementType"/>

    <... type declaration ..>
</xs:schema>

So far all goes well, with the exception of the "xmlns" attribute in the output "xs:schema" element, which should hold the value of the "prefix" attribute from the "library" input element. I am trying to achieve this with the following literal result element inside the template that matches the library element:

<xs:schema xmlns="{@prefix}" targetNamespace="{@prefix}">
  ...
</xs:schema>

(XML schema requires both the xmlns and the targetNamespace attributes to hold the same value). However, the result I get is:

<xs:schema xmlns="{@prefix}" targetNamespace="test">

Note that the value expression was resolved for the targetNamespace attribute, but not for the xmlns attribute.

Is this an error with Xalan, or am I missing something? Does anyone have a suggestion how to achieve the desired result?

TIA,
Christian



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



-- www.simonwoodside.com :: www.openict.net :: www.semacode.org 99% Devil, 1% Angel


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Current Thread
Keywords