This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Retriving a value of default attribute from schema(.xsd)


Hi Vadiraj,

> while parsing an xml file using xml schema as validator for that
> file, the default value declared for a particular attribute is not
> been picked up by the parser. while the code works fine with the
> dtd. As a result the java source code returns null pointer
> exception.

There's a big distinction between validating an XML document against
an XML Schema (which is something that Xerces supports) and passing on
the information made available through that validation
(post-schema-validation infoset (PSVI)) through to the XSLT processor.

As far as I know, there are no XSLT processors that will access and
use the PSVI in the same way that they access and use the
post-DTD-validation infoset. You'll see the PSVI being used in XSLT
2.0, but for now if you want to set a default for an attribute you
should use a DTD.

But it's very peculiar that you're getting a null pointer exception
from not having the default attribute value present! I'd have a look
at your code and make it more robust, such that the stylesheet assumes
the default value for the attribute if the attribute is not present.
Alternatively, you could create an XSLT transformation that adds the
default and fixed attribute and element values to the XML document
before the main transformation.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]