Subject: RE: x-schema in source xml causing no matches...
From: Mike Ferrando <mikeferrando@xxxxxxxxx>
Date: Wed, 21 Jul 2004 06:55:28 -0700 (PDT)
|
Warren W.,
I had the same problem. I was trying to use a stylesheet on an XML
document to process it to HTML.
Everytime I opened up the XSL I got all these errors. I even tried to
use the "create schema/dtd" function in XmlSpy and it didn't work.
My purpose was to edit the XML, not the XSL.
What I did was to never open the XSL in XmlSpy. I merely clicked on
the xsl tool bar button and browsed to find the stylesheet I wanted.
Everything was fine then.
I spoke to some other people who use XmlSpy alot and they said that
they do not use this program to edit their XSL.
Mike F.
Washington, DC
--- Michael Kay <mhk@xxxxxxxxx> wrote:
> You need to stop XML Spy from trying to validate your stylesheet
> against a
> schema. I don't know the product well enough to know why it is
> trying to do
> this, but it's this that is causing the trouble.
>
> After adding the namespace declaration to your stylesheet, you need
> to refer
> to the dt_application element as src:dt_application.
>
> Michael Kay
>
> > -----Original Message-----
> > From: Wright, Warren [mailto:Warren.Wright@xxxxxxxxxxxxxxxxxx]
> > Sent: 21 July 2004 00:39
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: x-schema in source xml causing no matches...
> >
> > Hi list,
> >
> > The xml I am trying to transform has an xmlns declaration that
> has
> > "x-schema:" in it, as shown below. When I try to transform
> > it, I don't
> > match on any of the elements that are within that
> > "x-schema:..." namespace.
> >
> > I tried fixing this by adding
> > xmlns:src="x-schema:http://www.qa.dealertrack.com/schemas/dtap
> > p_v2_0.xdr" to
> > the stylesheet, but when I do this xml spy complains that my
> > xslt is no
> > longer valid. Specifically, it tells me "This file is not valid:
> Root
> > element of document 'filename.xslt' is either not defined in
> > DTD/Schema
> > document or part of the wrong Namespace".
> >
> > See below for the xml and xslt that shows this problem:
> >
> > The xml my customer sends looks something like this
> > (abbreviated version):
> >
> > <root>
> > <Scorex_Header>
> > <Call_Number>4</Call_Number>
> > </Scorex_Header>
> > <dt_application active="yes" status="new" dtversion="2.0"
> >
>
xmlns="x-schema:http://www.qa.dealertrack.com/schemas/dtapp_v2_0.xdr">
> > <key_data optout="no">
> > <dt_lender_id>ETR</dt_lender_id>
> > </key_data>
> > </dt_application>
> > </root>
> >
> > My XSLT looks like this (abbreviated):
> >
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > <xsl:output method="xml" version="1.0" encoding="UTF-8"
> > indent="yes"/>
> > <xsl:template match="root">
> > <root>
> > <xsl:apply-templates/>
> > </root>
> > </xsl:template>
> > <xsl:template match="dt_application" name="dtApplication">
> > <dt_application>
> > <xsl:element name="active">
> > <xsl:value-of select="@active"/>
> > </xsl:element>
> > <xsl:apply-templates/>
> > </dt_application>
> > </xsl:template>
> > </xsl:stylesheet>
> >
> > Assume that the given dt_application section of the input xml
> > really is
> > valid according to the dtapp_v2_0.xdr...it isn't in the samples
> above
> > because I abbreviated the xml for purposes of making the
> > email look cleaner.
> >
> > Somehow, when the xml fragment doesn't match the xdr the xslt
> > engine ignores
> > the namespace, and my xslt works completely, but in the true
> > xml I receive
> > the dt_application section DOES match the xdr, and so my xslt
> > doesn't match
> > on any of the elements within the dt_application section.
> >
> > Thanks for any help!
> >
> > Warren Wright
>
>
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
|