 |
| 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
|
|
|
|

July 12th, 2005, 08:36 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 !
|
|

July 12th, 2005, 08:56 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

July 13th, 2005, 01:10 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 13th, 2005, 02:08 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

July 13th, 2005, 02:08 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

July 13th, 2005, 03:20 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 13th, 2005, 03:36 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

July 13th, 2005, 04:46 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|
 |