Charles,
Thank you so much for your reply and for taking the time to write out
the explanation on namespaces. This clears things up greatly. I added
the namespace declaration to my XSLT and things are now working as
expected.
On Jul 27, 2006, at 9:28 AM, cknell(_at_)onebox(_dot_)com wrote:
A namespace is indicated by the inclusion of the "xmlns=''"
attribute. It's purpose is to distinguish elements from one
another. For example, if there are two "Johns" in your school or
office, you would customarily distinguish them by using a surname
to qualify them. Thus you know that "John Smith" is different from
"John Jones" because one is in the "Smith namespace" while the
other is in the "Jones namespace".
Your sample xml has such an attribute:
xmlns="http://www.filemaker.com/fmpxmlresult"
Consequently, all nodes in the document are in the "http://
www.filemaker.com/fmpxmlresult" namespace.
The opening tag of an XSLT stylesheet usually looks like this:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
or
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
This tells the processor that all element names prefixed with
"xsl:" belong in the "http://www.w3.org/1999/XSL/Transform" namespace.
Because "http://www.filemaker.com/fmpxmlresult" is declared without
a prefix, it is said to be an "anonymous namespace".
Your XSLT file has to make mention of this namespace and give it an
alias for the stylesheet to "see" the nodes in the source document.
You could do this by including a namespace declaration in the
<xsl:stylesheet> opening tag similar to the xsl namespace declaration.
Unlike personal names in the English-speaking world where the
"family namespace" appears after the given name, in the xml world,
namspaces are indicated by a prefix and a colon.
What form that prefix takes is not material so long as it is within
the bounds of namespace naming rules and isn't the same as any
other prefix used in any of the documents involved in the
transformation. There's nothing magical about the particular
letters used in a prefix.
So, you might change your <xsl:stylesheet> opening tag to read like
this:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult">
Thereafter in your stylesheet, any time you want to access a node
from the source document, you will prefix the name with "fmp:".
Thus a template to match the root element would read like this:
<xsl:template match="fmp:FMPXMLRESULT">
</xsl:template>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--