Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2005, 08:36 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Schema URL

I would like to change the URL in the XML tag <... xsi:noNamespaceSchemaLocation="http://xxx.xxx>
into
<... xsi:noNamespaceSchemaLocation="http://yyy.yyy>
The change of an XML attribute is somewhat trivial - but in this case
functions the following piece of code not:
<xsl:template match="@* | node()">
<xsl:copy>
  <xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
  <xsl:template match="@xsi:noNamespaceSchemaLocation">
  <xsl:attribute name="{name()}">yyy.yyy</xsl:attribute>
</xsl:template>

Any hints ?
Thanks in advance !



 
Old July 12th, 2005, 08:56 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The code looks fine to me. I suggest you supply a complete stylesheet, a complete source document, and a copy of the output you are getting. (And for good measure, tell us which processor was used).

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 13th, 2005, 01:10 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael,
thanks for the quick reply.
I test the XSLT by means of the Altove XML Spy (Version 2004) under Win-XP. The parser is also the MS XML Parser.
The error message: "This file is not valid. Invalid prefixError in XPath expression, invalid prefix".
The line in error: <xsl:template match="@xsi:noNamespaceSchemaLocation">
And here the complete first tag:
<common xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://mydomain/eu/j2ee/entwicklungsprozess/configuration/documents/schemas/common.xsd">

Gabor Markon
HVB Systems

 
Old July 13th, 2005, 02:08 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to include the declaration

xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"

in the stylesheet if it uses the xsi: prefix.



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 13th, 2005, 02:08 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

P.S. I'm guessing that's what you did wrong, I can only guess, because you didn't submit a complete stylesheet as I asked you to.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 13th, 2005, 03:20 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael,
sorry, but I can't send the whole stylesheet while a)it's too large and b)it has confidential informations.
But in the tag I've sent - here once again:

<common xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://mydomain/eu/j2ee/entwicklungsprozess/configuration/documents/schemas/common.xsd">

...I have the declaration as You meant already included. I think the parser sees xsi:noNamespaceSchemaLocation not as a 'normal' attribute. The same coding above functions without any problem for other attributes...

Cheers
Gabor Markon


 
Old July 13th, 2005, 03:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I assumed that the <common> element was part of the source document, not part of the stylesheet.

If you have the namespace declared in the stylesheet then I guessed wrong, but you can't expect people to debug your code if you keep it secret.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 13th, 2005, 04:46 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael,
I've overlooked the fact, You suggested the declaration for the stylesheet and not for the source...
It works with the daclaration in the stylesheet now very well !
Sorry for the incoveniencies and thanks again.

Cheers
Gabor Markon






Similar Threads
Thread Thread Starter Forum Replies Last Post
Change URL SKhna ASP.NET 2.0 Basics 3 February 28th, 2008 01:25 PM
How to change file path to http url cJeffreywang BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 July 25th, 2007 12:18 AM
How to change an ASP: Image Url at runtime ergaurav.nex ASP.NET 1.0 and 1.1 Professional 2 September 5th, 2006 03:44 AM
Schema to Schema conversion onlyda XSLT 5 March 23rd, 2006 12:25 PM
How to keep url end w/ index.htm when page change bekim HTML Code Clinic 3 January 25th, 2005 05:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.