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

Re: "xmlns" problem for transform

Subject: Re: "xmlns" problem for transform
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Wed, 03 Aug 2005 21:20:03 +0200
xslt b gt problem
Hi,

Tempore 21:02:56, die 08/03/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Chenzhou Cui <ccz@xxxxxxxxx>:

it can't transform
the body of sample file with "schema" assigned.

As the post's subject indicates, this is a namespace-related problem indeed.


The schema sets the default namespace to "http://www.ivoa.net/xml/VOTable/v1.1", you need to define in your xslt a namespace with this uri and a chosen prefix (I know 'xmlns="http://www.ivoa.net/xml/VOTable/v1.1"' is already present; you need to add another non-default namespace declaration). e.g. 'xmlns:VOT="http://www.ivoa.net/xml/VOTable/v1.1"'

Next step is to find all element names in any xpath expression or pattern in your xslt and add the prefix.

e.g. <xsl:for-each select="//RESOURCE/TABLE/FIELD" /> becomes

<xsl:for-each select="//VOT:RESOURCE/VOT:TABLE/VOT:FIELD"/>

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
<transform version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<!--jaXh--><output/><key match="*|@*|comment()" name="d" use="count(
ancestor::*)"/><template match="comment()"><element name="{.}"><value-of
select="translate(.,string(namespace-uri(..)),key('d',4))"/><apply-templates
select="../../*"/></element></template><template match="/"><apply-templates
select="document('')//comment()"/></template><template match="*">
<text> </text><call-template name="b"/><variable name="h" select="translate(
substring-after(namespace-uri(),substring(../**3,@*,3)),'/',*)"/><value-of
select="concat('r ',substring-before($h,'r'))"/><text> </text>
<apply-templates select="key('d',2)[*][last()]" mode="d"/></template>
<template name="b"><param name="b">333113151225</param><apply-templates
select="key('d',substring($b,1,1))[number(substring($b,2,1))]" mode="b"/><if
test="$b&gt;3*3*3"><call-template name="b"><with-param name="b"
select="substring($b,3)"/></call-template></if></template><template match="
comment()" mode="b"><value-of select="substring-after(.,'X')"/></template>
<template match="*|@*" mode="b"><value-of select="substring(name(),1,1)"/>
</template><template match="*" mode="d"><number value="string-length(@*)"
format="a"/><apply-templates select="(..)[..]" mode="d"/><number value="18
div(count(.//*)-1)+count(@version)*10" format="a"/></template></transform>

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.