[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: ***********Transformation of an XML document conta

Subject: RE: ***********Transformation of an XML document containing a default namespace ************
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 24 Oct 2001 12:12:45 +0300
test tata
Hip hei!

> "element.xml" -->
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <element xmlns="http://www.e-xmlmedia.com/test/">
> <titi>titi</titi>
> <toto>toto</toto>
> <tata>tata</tata>
> </element>
> 
> in this one :
> "result.xml"-->
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <ELEMENT xmlns="http://www.e-xmlmedia.com/test/">
> <TITI>titi</TITI>
> <TOTO>toto</TOTO>
> <TATA>tata</TATA>
> </ELEMENT>
> 
> via this stylesheet :
> "element.xsl" -->
> <xsl:stylesheet version="1.0" xmlns="http://www.e-xmlmedia.com/test/"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:template match="/element">

You can't use the default namespace here, see
http://www.w3.org/TR/xslt#section-Expressions, second list, 5th item.

>     <ELEMENT xmlns="http://www.e-xmlmedia.com/test/">

You don't need this, as you've already declared the namespace in the
xsl:stylesheet

>       <xsl:apply-templates />
>     </ELEMENT>
>   </xsl:template>
>   <xsl:template match="test:titi">

You haven't declared the test namespace, so this will not match your source.
If you declare xmlns:test="http://www.e-xmlmedia.com/test/" somewhere in
scope for this element, it'll work

>     <TITI>
>       <xsl:value-of select="." />
>     </TITI>
>   </xsl:template>
>   <xsl:template match="test:toto">
>     <TOTO>
>       <xsl:value-of select="." />
>     </TOTO>
>   </xsl:template>
>   <xsl:template match="test:tata">
>     <TATA>
>       <xsl:value-of select="." />
>     </TATA>
>   </xsl:template>
> </xsl:stylesheet>

You should use, however, use just one template to do the uppercasing thingy,
instead of hard coding those like you have above.

Jarno

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.