Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > targetNamespace and XSL

Reply
Thread Tools

targetNamespace and XSL

 
 
CB
Guest
Posts: n/a
 
      06-27-2003
I'm just picking up XSL, and am having problems with namespaces. None
of the posts I've read through/tried seem to work so I must be missing
something basic. Please help.

I started with a simple example, and created an XSD, XML and XSL that
work. They are;

---XSD--
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="source">
...

--XML--
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Page3.xsl"?>
<source>
...

--XSL--
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="source">
<xsl:apply-templates select="bold"/>
<xsl:apply-templates select="red"/>
<xsl:apply-templates select="italic"/>
</xsl:template>
...


As I said, this all works, and I get my expected outputs. Now,
I want to add a targetNamespace to the XSD. So, I've changed my
three files as follows;


---XSD--
<xs:schema targetNamespace="Page3"
xmlnss="http://www.w3.org/2001/XMLSchema" xmlns3="Page3"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="source">
...

--XML--
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Page3tns.xsl"?>
<source xmlns="Page3"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="Page3 Page3tns.xsd">
...

--XSL--
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlnsage3="x-schemaage3tns.xsd">
<xsl:template match="Page3:source">
<xsl:apply-templates select="Page3:bold"/>
<xsl:apply-templates select="Page3:red"/>
<xsl:apply-templates select="Page3:italic"/>
</xsl:template>
...

This won't work. I've tried several variations on the namespace
for p3 and Page3, and I've gotten various error messages and
incorrect output.

So, what is the correct line for declaring the Page3 namespace in
the XSL?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
targetNamespace/import conflict Charles Fineman XML 2 02-09-2004 08:39 PM
Help: targetNamespace value on my machine... Gianni Rubagotti XML 1 02-05-2004 04:26 PM
Re: transforming to an XML Schema - targetNamespace C. M. Sperberg-McQueen XML 0 07-29-2003 10:57 PM
targetnamespace - what is it?!?! kevin bailey XML 1 06-25-2003 11:47 AM



Advertisments