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

Re: Bad schemas

Subject: Re: Bad schemas
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Sat, 27 Jul 2002 09:54:28 +0200
ancestor shevlen
Jeff Shevlen wrote:
Hi,

Can anyone shed some light on why Xalan parses an XML doc with no
schema no namespace (skills)differently than the identical doc
(skills2), with a schema (that is not validating properly yet), and a
namespace?

This is a FAQ. The XPath expressions and template match expressions need an explicit namespace prefix, even if your sourtce XML uses the default namespace and therefore no namespace prefix.

Try

 <?xml version = "1.0" encoding = "UTF-8"?>
 <xsl:stylesheet version = "1.0"
   xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
   xmlns:skills = "http://www.abc.com/skills">

<xsl:output method = "xml" indent = "yes"/>

   <xsl:template match = "//skills:related_skill">
     <xsl:element name = "test">
       <xsl:text>XXXX   </xsl:text>
       <xsl:attribute name = "skill_IDREF">
         <xsl:value-of select = "@skills:skill_IDREF"/>
       </xsl:attribute>
     </xsl:element>
   </xsl:template>

BTW regarding the template above:
1. You can write it much shorter
2. It probably wont work, because you add the text child
   before the attribute.
Try
   <xsl:template match = "//skills:related_skill">
     <test skill_IDREF="{@skills:skill_IDREF}">
       <xsl:text>XXXX   </xsl:text>
     </test>
   </xsl:template>
instead.

Note that the "test" element is in the default namespace, not
in the skills namespace.

J.Pietschmann


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.