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

Re: Filemaker XSL woes

Subject: Re: Filemaker XSL woes
From: Chad Chelius <cchelius@xxxxxxxxxxxxxxx>
Date: Thu, 27 Jul 2006 14:50:02 -0400
filemaker xsl
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@xxxxxxxxxx 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@xxxxxxxxxx - email

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.