473,473 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XSL Transform Prevented by a Declaration

XSLT fails when the XML file contains this top-level declaration:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<P2Main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:schemas-Professional-Plug-in:P2:ClipMetadata:v3.0">
<ClipName>0001FM</ClipName>
</P2Main>

However, XSLT succeeds when I modify the XML declaration to this:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<P2Main>
<ClipName>0001FM</ClipName>
</P2Main>

What is the declaration conflict here, and why would that simple deletion
make it work?
By the way, the XSL is

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="P2Main/ClipName"/>
</xsl:template>
</xsl:stylesheet>

Jun 4 '06 #1
3 1391


Al Hatch wrote:
XSLT fails when the XML file contains this top-level declaration:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<P2Main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:schemas-Professional-Plug-in:P2:ClipMetadata:v3.0">
<ClipName>0001FM</ClipName>
</P2Main>
<xsl:stylesheet version="1.0"
Add
xmlns:cm="urn:schemas-Professional-Plug-in:P2:ClipMetadata:v3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
and then use e.g.
<xsl:template match="/">
<xsl:value-of select="P2Main/ClipName"/>


<xsl:value-of select="cm:P2Main/pm:ClipName" />
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 4 '06 #2
On Sun, 4 Jun 2006 07:54:47 -0700, Martin Honnen wrote
(in article <44**********************@newsread2.arcor-online.net>):
<xsl:value-of select="cm:P2Main/pm:ClipName" />


There was a typo in your repsonse (/pm should be /cm), but once I changed
that, it worked.

Apparently, namespace declarations in the XSL document must match the
namespace declarations in its source XML document, but I'm not clear on what
the cm namespace is. I guess I have to go back to the manual to find out
what's going on here.

Thanks.

Jun 4 '06 #3


Al Hatch wrote:

Apparently, namespace declarations in the XSL document must match the
namespace declarations in its source XML document, but I'm not clear on what
the cm namespace is. I guess I have to go back to the manual to find out
what's going on here.


The major problem is that while the XML document contains elements in a
default namespace (declared with xmlns="someURI") XPath needs a prefix
bound to the URL to match elements in the namespace.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barry Anderberg | last post by:
I have an XML document that I am trying to display in my ASP.NET page. I am using an XSL Transform to display repeating XML data in a specific format. It reads the data, and displays it on my...
0
by: Sharon | last post by:
Hi y'all, I have a Delphi dll which generates XML from data in a db. I then use an XSL to transform and display the data in tabular form. Now what I want is a link saying 'export table', and make...
0
by: Xiaolei Li | last post by:
first off, i'm a total newbie at this stuff so excuse any wrong usage of terminology or whatever else. i have a XSL to transform a Document such that all "text" nodes will have a "SPAN" inserted...
3
by: Andy | last post by:
Hi all, I'm having a problem doing an Xslt transform in code. I've done it before, so I'm not really sure why its not working. The problem is that the result of the transform is an empty...
1
by: Dan Beanweed | last post by:
I have this xslt : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="p" select="'q'"/> <xsl:output...
8
by: Dilip | last post by:
I was reading the C++ templates (Josuttis et al) book and came across an example that left me scratching my head.. there is a function template: template<typename T, int val> T addvalue(T...
7
by: Bilal | last post by:
Hello all, I came across this problem while working out the bugs in my identity trasnformation stylesheets but sidestepped it for later to see if there is an easier/better solution. This is...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
19
by: Taras_96 | last post by:
Hi all, A poster at http://bytes.com/forum/thread60652.html implies that using strtoupper in transform doesn't work because ctype.h may define strtoupper as a macro: "The problem is that most...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.