W3C home > Mailing lists > Public > www-forms@w3.org > July 2002

RE: XSLT and XForm doc namespaces

From: Tomayko, Ryan <Ryan_Tomayko@stercomm.com>
Date: Thu, 11 Jul 2002 16:07:54 -0400
Message-ID: <D037B3982A54D611BA5E000629383540436F70@scidubmsg02.amr.stercomm.com>
To: "'www-forms@w3.org'" <www-forms@w3.org>

It looks like you want to default the namespace to the XForms namespace but
instead your declaring the xforms prefix.

You should either declare the XForms namespace as default or qualify each
element as being in the XForms namespace..

Try..

<selectOne xmlns='http://www.w3.org/2002/01/xforms' class='' ref='10'
selectUI='listbox'>
	<caption>Which statement best describes your dieting
history?</caption>
	<item>
		<caption>success</caption>
		<value>1</value>
	</item>
</selectOne>


or


<xforms:selectOne xmlns:xforms='http://www.w3.org/2002/01/xforms' class=''
ref='10' selectUI='listbox'>
	<xforms:caption>Which statement best describes your dieting
history?</xforms:caption>
	<xforms:item>
		<xforms:caption>success</xforms:caption>
		<xforms:value>1</xforms:value>
	</xforms:item>
</xforms:selectOne>


Both should work properly.

- Ryan


-----Original Message-----
From: Calbazana, Al [mailto:ACalbazana@epotec.com] 
Sent: Thursday, July 11, 2002 2:54 PM
To: 'www-forms@w3.org'
Subject: XSLT and XForm doc namespaces


Hello,

I am putting together a little XSLT to assist with the processing of XForm
UI markup to HTML.  I am stumbling on a namespace issue that I can not seem
to resolve.  Any XPath help here would be appreciated!

A sample xform doc looks like:

<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="./xforms.xsl"?>

<form name="myform">
            <selectOne xmlns:xforms='http://www.w3.org/2002/01/xforms'
class='' ref='10' selectUI='listbox'>
<caption>Which statement best describes your dieting history?</caption>
<item>
<caption>success</caption>
<value>1</value>
</item>
            </selectOne>
</form> 

A sample xsl looks like:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
            xmlns:xforms="http://www.w3.org/2002/01/xforms">

            <xsl:template match="/form">
                        <html>
                                    <body>
                                                <xsl:apply-templates/>
                                    </body>
                        </html>
            </xsl:template>
            
            <xsl:template match="xforms:selectOne">
                        <xsl:apply-templates select="xforms:caption"/>
                        <select>
                                    ...
                        </select>
            </xsl:template>
            
            <xsl:template match="xforms:caption">
                        <xsl:value-of select="."/>
            </xsl:template>
            
            <xsl:template match="*|@*|node()"/>
</xsl:stylesheet>                       

Why don't xforms:caption or xforms:selectOne match?  The namespaces are
correct, but the template match fails...

I had another document that used a prefix in front of every element (e.g. -
<xforms:selectOne/>).  This seemed to work nicely w/ XPath, but the document
was rather bloated... 

Thanks,

Al


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************
Received on Thursday, 11 July 2002 16:15:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:51 GMT