This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Schema location in target XML document
- From: "paul morgan" <pmorg at lycos dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 15 May 2002 07:33:58 -0700
- Subject: RE: [xsl] Schema location in target XML document
- Organization: Lycos Mail (http://www.mail.lycos.com:80)
- Reply-to: xsl-list at lists dot mulberrytech dot com
While trying to find an answer to question, I came across this thread in the archives, and even though it's about a month old I thought I'd have a go at it.
In response to the original post, both Michael and Oleg suggested using a literal result element, like so:
<courses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\Docs\CorpPortal\clschema.xsd">
However, if you really needed to use "xsl:element", I believe you could use "xsl:attribute":
<xsl:element name="courses">
<xsl:attribute name="xsi:noNamespaceSchemaLocation"
namespace="http://www.w3.org/2001/XMLSchema-instance">
<xsl:value-of select="'D:\Docs\CorpPortal\clschema.xsd'" />
</xsl:attribute>
</xsl:element>
Since I'm new at this game hopefully someone will correct me if I'm wrong.
Paul
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Uslu,
> Cihan Y (MED)
> Sent: Monday, April 22, 2002 10:11 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Schema location in target XML document
>
>
> Hi,
> I get my data from OracleDB, create the XML String, then apply the XSLT
> script, and then I need to validate it against our schema, this is where
> i'm not clear. How can I make it sure that I'm validating against a
> schema located in a URL? Any help is appreciated.
>
> Cihan
>
>
> This is what I have in my XSLT script:
> ---------------------------------
> <xsl:transform version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent = "yes"/>
> <xsl:template match="/">
> <xsl:element name="courses"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:noNamespaceSchemaLocation="D:\Docs\CorpPortal\clschema.xsd">
> <xsl:apply-templates />
> </xsl:element>
> </xsl:template>
> ------------------------
>
>
> This code doesnt put the schema location in target XML. This is the
> output I get:
> ------------------------------
> <?xml version="1.0" encoding="UTF-16"?>
> <courses>
> <course compid="11" busunitid="66" coursenumber="C/AMX4">
> --------------------------
>
> This is what I should be getting in target XML
> --------------------
> <?xml version="1.0" encoding="UTF-16"?>
> <courses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="http://webd01.corporate.ge.com/learningpo
> rt/learningportal/schema/CLSchema.xsd">
> <course compid="11" busunitid="66" coursenumber="C/AMX4">
> --------------------
________________________________________________________
Outgrown your current e-mail service?
Get a 25MB Inbox, POP3 Access, No Ads and No Taglines with LYCOS MAIL PLUS.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list