Subject: Re: [xsl] Bad schemas From: "Jeff Shevlen" <jeff@xxxxxxxxxxxxxx> Date: Tue, 30 Jul 2002 22:51:44 -0700 |
Thanks for your reply. Sorry to get back to you so long after the fact. You've helped out quite a bit. ----- Original Message ----- From: "J.Pietschmann" <j3322ptm@xxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Saturday, July 27, 2002 12:54 AM Subject: Re: [xsl] Bad schemas > 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 > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Bad schemas, J.Pietschmann | Thread | [xsl] An easy problem, alex ek |
[xsl] Space Between 2 consecutive N, Kumar V. | Date | [xsl] Which namespace to use, Agaram Madhavaraju |
Month |