xsl-list
[Top] [All Lists]

Re: Attribute's default value in xsd doesn't show in xslt

2003-05-29 07:11:38
I have replaced my abc.xml with the code you provided and it still doesn't
recognize the default value from the abc.xsd. Also, you wrote 
'xsi:schemaLocation="abc
abc.xsd"', what is the syntax of "abc abc.xsd"?

Here are my three files again:

abc.xsd
-----------------------------------

<?xml version="1.0" ?>
<xs:schema id="abc" targetNamespace="abc" xmlns:omm="abc" 
xmlns:xs="http://www.w3.org/2001/XMLSchema";
version="1.0">
        <xs:element name="structure">
                <xs:complexType>
                        <xs:attribute name="defaultValue" type="xs:string" 
use="optional" default="xcs"
/>
                </xs:complexType>
        </xs:element>
</xs:schema>


abc.xml
----------------------------------

<?xml version="1.0" encoding="utf-8" ?>
<structure xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="abc
abc.xsd" xmlns="abc">
</structure>


abc.xslt
----------------------------------

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns="http://www.w3.org/1999/XSL/Transform";
    xmlns:omm="abc">
    
<xsl:output method="text" />

<xsl:template match="/">
        <xsl:apply-templates select="omm:structure" />
</xsl:template>

<xsl:template match="omm:structure">
        <xsl:value-of select="@defaultValue" />
</xsl:template>

</xsl:stylesheet>





-- Original Message --
Date: Thu, 29 May 2003 16:56:46 +0200
From: Oleg Tkachenko <olegt(_at_)multiconn(_dot_)com>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Attribute's default value in xsd doesn't show in xslt
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


Eran Hammer-Lahav wrote:

Thanks for your quick reply. Can you tell my how I can modify my code
to
turn validation on? I am using xalan from the command line, not through
the Java API.

Xalan's command line does validate by default, but usually if you want
to

validate you have to specify schema document, so try this:

<structure xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="abc abc.xsd" xmlns="abc"></structure>

-- 
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel


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




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