Re: [xsl] Losing schemalocation

Subject: Re: [xsl] Losing schemalocation
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Wed, 16 Feb 2005 09:34:38 -0700
So I'm a bit lost... not sure what is copying the xsl:stylesheet node,
but it should grab all.
This is the top level match:

<!-- get top level node -->
<xsl:template match="@* | node()">
  <xsl:copy>
	<xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
</xsl:template>

Ahhh... maybe the problem is this, that I need to explicitly add these
instructions.  These elements are not part of the original XML source
(that is being transformed) and I do need to add these elements.  My
mistake, I added these processing instructions to the identity
tranformation stylesheet (as instructions for the stylesheet).  So...
where and how do I add these further processing instructions?

Original XML is looking like this:
<?xml version="1.0" encoding="utf-8"?>
<data_root>
<Cree-Sample>
.....
</Cree-Sample>
</data_root>

Expected result is:

<?xml version="1.0"?>
<sd:DataRoot xmlns:sd="http://www.mygov.gov/schemas/ns/sdetail/2001/1.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.mygov.gov/schemas/ns/sdetail/2001/1.0
http://www.mygov.gov/schemas/sdetail/SDTransactions.xsd";>
...
</sd:DataRoot>

Ohh man, I'm being stupid!  It appears that the expected output has
the processing instructions as part of the root data source, but is
the common practice, or should it appear as part of the <?xml ... ?>
decleration?

Someone set me straight.  Where do processing instructions belong in
an XML source?


On Wed, 16 Feb 2005 08:27:15 +0200, Jarno.Elovirta@xxxxxxxxx
<Jarno.Elovirta@xxxxxxxxx> wrote:
> Hi,
> 
> > I have the following decleration:
> >
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> > xmlns:sd="http://www.mygov.gov/schemas/ns/sdetail/2001/1.0";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://www.mygov.az.gov/schemas/ns/sdetail
> > /2001/1.0
> > http://www.mygov.gov/schemas/sdetail/SDTransactions.xsd";
> > xmlns:date="http://exslt.org/dates-and-times";
> > exclude-result-prefixes="date">
> >
> > Upon transformation, I am losing the following:
> >
> > xmlns:xsl=...
> > xsl:schemaLocation=...
> >
> > What is missing in my identity transformation?
> 
> Depends on what your identity transformation looks like. Does the template that matches xsl:stylesheet copy all of its attributes?
> 
> Cheers,
> 
> Jarno - Nick Sentience: March 2003 Mix

Current Thread