XML Namespaces and How They Affect XPath and XSLT 188
This article explores the ins and outs of XML namespaces and their ramifications on a number of XML technologies that support namespaces. What follows is a shortened version of my first Extreme XML column.
Overview of XML Namespaces
As XML usage on the Internet became more widespread, the benefits of being able to create markup vocabularies that could be combined and reused similarly to how software modules are combined and reused became increasingly important. If a well defined markup vocabulary for describing coin collections, program configuration files, or fast food restaurant menus already existed, then reusing it made more sense than designing one from scratch. Combining multiple existing vocabularies to create new vocabularies whose whole was greater than the sum of its parts also became a feature that users of XML began to require.
However, the likelihood of identical markup, specifically XML elements and attributes, from different vocabularies with different semantics ending up in the same document became a problem. The very extensibility of XML and the fact that its usage had already become widespread across the Internet precluded simply specifying reserved elements or attribute names as the solution to this problem.
The goal of the W3C XML
namespaces recommendation was to create a
mechanism in which elements and attributes within an
XML document that were from different markup
vocabularies could be unambiguously identified and
combined without processing problems ensuing. The XML
namespaces recommendation provided a method for
partitioning various items within an XML document
based on processing requirements without placing undue
restrictions on how these items should be named. For
instance, elements named <template>
, <output>
, and <stylesheet>
can occur in an
XSLT stylesheet without there being ambiguity as to
whether they are transformation directives or
potential output of the transformation.
An XML namespace is a collection of names, identified by a Uniform Resource Identifier (URI) reference, which are used in XML documents as element and attribute names.
Namespace Declarations
A namespace declaration is typically used to map a namespace URI to a specific prefix. The scope of the
prefix-namespace mapping is that of the element that
the namespace declaration occurs on as well as all its
children. An attribute declaration that begins with
the prefix xmlns:
is a
namespace declaration. The value of such an attribute
declaration should be a namespace URI which is the namespace
name.
Here is an example of an XML document where the
root element contains a namespace declaration that
maps the prefix bk
to the
namespace name urn:xmlns:25hoursaday-com:bookstore
and its child element contains an inventory
element that contains a
namespace declaration that maps the prefix inv
to the namespace name urn:xmlns:25hoursaday-com:inventory-tracking
.
<bk:book>
<bk:title>Lord of the Rings</bk:title>
<bk:author>J.R.R. Tolkien</bk:author>
<inv:inventory status="in-stock" isbn="0345340426"
xmlns:inv="urn:xmlns:25hoursaday-com:inventory-tracking" />
</bk:book>
</bk:bookstore>
In the above example, the scope of the namespace
declaration for the urn:xmlns:25hoursaday-com:bookstore
namespace name is the entire bk:bookstore
element, while that of
the urn:xmlns:25hoursaday-com:inventory-tracking
is the inv:inventory
element.
Namespace aware processors can process items from both
namespaces independently of each other, which leads to
the ability to do multi-layered processing of XML
documents. For instance, RDDL
documents are valid XHTML documents
that can be rendered by a Web browser but also contain
information using elements from the http://www.rddl.org
namespace that
can be used to locate machine readable resources about
the members of an XML namespace.
It should be noted that by definition the prefix
xml
is bound to the XML namespace
name and this special namespace is automatically
predeclared with document scope in every well-formed
XML document.
Default Namespaces
The previous section on namespace declarations is
not entirely complete because it leaves out default
namespaces. A default namespace declaration is an
attribute declaration that has the name xmlns
and its value is the namespace
URI that is the namespace name.
A default namespace declaration specifies that every unprefixed element name in its scope be from the declaring namespace. Below is the bookstore example utilizing a default namespace instead of a prefix-namespace mapping.
<bookstore xmlns="urn:xmlns:25hoursaday-com:bookstore"><book>
<title>Lord of the Rings</bk:title>
<author>J.R.R. Tolkien</bk:author>
<inv:inventory status="in-stock" isbn="0345340426"
xmlns:inv="urn:xmlns:25hoursaday-com:inventory-tracking" />
</book>
</bookstore>
All the elements in the above example except for
the inv:inventory
element
belong to the urn:xmlns:25hoursaday-com:bookstore
namespace. The primary purpose of default namespaces
is to reduce the verbosity of XML documents that
utilize namespaces. However, using default namespaces
instead of utilizing explicitly mapped prefixes for
element names can be confusing because it is not
obvious that the elements in the document are
namespace scoped.
Also, unlike regular namespace declarations,
default namespace declarations can be undeclared by
setting the value of the xmlns attribute to the
empty string. Undeclaring default namespace
declarations is a practice that should be avoided
because it may lead to a document that has unprefixed
names that belong to a namespace in one part of the
document, but don't in another. For example, in the
document below only the bookstore
element is from the urn:xmlns:25hoursaday-com:bookstore
while the other unprefixed elements have no namespace name.
<book xmlns="">
<title>Lord of the Rings</bk:title>
<author>J.R.R. Tolkien</bk:author>
<inv:inventory status="in-stock" isbn="0345340426"
xmlns:inv="urn:xmlns:25hoursaday-com:inventory-tracking" />
</book>
</bookstore>
This practice should be avoided because it leads to extremely confusing situations for readers of the XML document. For more information on undeclaring namespace declarations, see the section on Namespaces Future.
Qualified and Expanded Names
A qualified name, also known as a QName, is an XML name called the local name optionally preceded by another XML name called the prefix and a colon (':') character. The XML names used as the prefix and the local name must match the NCName production, which means that they must not contain a colon character. The prefix of a qualified name must have been mapped to a namespace URI through an in-scope namespace declaration mapping the prefix to the namespace URI. A qualified name can be used as either an attribute or element name.
Although QNames are important mnemonic guides to determining what namespace the elements and attributes within a document are derived from, they are rarely important to XML aware processors. For example, the following three XML documents would be treated identically by a range of XML technologies including, of course, XML schema validators.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:complexType id="123" name="fooType"/>
</xs:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType id="123" name="fooType"/>
</xsd:schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<complexType id="123" name="fooType"/>
</schema>
The W3C XML Path Language recommendation describes an expanded name as a pair consisting of a namespace name and a local name. A universal name is an alternate term coined by James Clark to describe the same concept. A universal name consists of a namespace name in curly braces and a local name. Namespaces tend to make more sense to people when viewed through the lens of universal names. Here are the three XML documents from the previous example with the QNames replaced by universal names. Note that the syntax below is not valid XML syntax.
<{http://www.w3.org/2001/XMLSchema}schema><{http://www.w3.org/2001/XMLSchema}complexType id="123" name="fooType"/>
</{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}complexType id="123" name="fooType"/>
</{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}complexType id="123" name="fooType"/>
</{http://www.w3.org/2001/XMLSchema}schema>
To many XML applications, the universal name of the elements and attributes in an XML document are what is important, and not the values of the prefixes used in specific QNames. The primary reason the Namespaces in XML recommendation does not take the expanded name approach to specifying namespaces is due to its verbosity. Instead, prefix mappings and default namespaces are provided to save us all from developing carpal tunnel syndrome from typing namespace URIs endlessly.
Namespaces and Attributes
Namespace declarations do not apply to attributes
unless the attribute's name is prefixed. In the XML
document shown below the title
attribute belongs to the bk:book
element and has no namespace
while the bk:title
attribute
has urn:xmlns:25hoursaday-com:bookstore
as its namespace name. Note that even though both
attributes have the same local name the document is
well formed.
<bk:bookstore
xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">
<bk:book title="Lord of the Rings,
Book 3" bk:title="Return of the King"/>
</bk:bookstore> In the following example, the title
attribute still has no
namespace and belongs the book
element even though there is a default namespace
specified. In other words, attributes cannot inherit the default namespace.
<bookstore
xmlns="urn:xmlns:25hoursaday-com:bookstore">
<book title="Lord of the Rings, Book
3" />
</bookstore> Namespace URIs
A namespace name is a Uniform Resource Identifier (URI) as specified in RFC 2396. A URI is either a Uniform Resource Locators (URLs) or a Uniform Resource Names (URNs). URLs are used to specify the location of resources on the Internet, while URNs are supposed to be persistent, location-independent identifiers for information resources. Namespace names are considered to be identical only if they are the same character for character (case-sensitive). The primary justification for using URIs as namespace names is that they already provide a mechanism for specifying globally unique identities.
The XML namespaces recommendation states that namespace names are only to act as unique identifiers and do not have to actually identify network retrievable resources. This has led to much confusion amongst authors and users of XML documents, especially since the usage of HTTP based URLs as namespace names has grown in popularity. Because many applications convert such URIs to hyperlinks, it is irritating to many users that these "links" do not lead to Web pages or other network retrievable resource. I remember one user who likened it to being given a fake phone number in a social situation.
One solution to avoid confusing users is to use a
namespace-naming schema that does not imply network
retrievability of the resource. I personally use the
urn:xmlns:
scheme for this
purpose and create namespace names similar to urn:xmlns:25hoursaday-com
when
authoring XML documents for personal use. The problem
with homegrown namespace URIs is that they may run
counter to the intent of the Names in XML
recommendation by not being globally unique. I get
around the globally unique requirement by using my
personal domain name http://www.25hoursaday.com
as part of the namespace URI.
Another solution is to leave a network retrievable resource at the URI that is the namespace name, such as is done with the XSLT and RDDL namespaces. Typically, such URIs are actually HTTP URLs. A good way to name such URLs is by using the format favored by the W3C, which is as follows:
http://my.domain.example.org/product/[year/month][/area]See the section on Namespaces and Versioning for more information on using similarly structured namespace names as a versioning mechanism.
DOM, XPath, and the XML Information Set on Namespaces
The W3C has defined a number of technologies that provide a data model for XML documents. These data models are generally in agreement, but sometimes differ in how they treat various edge cases due to historic reasons. Treatment of XML namespaces and namespace declarations is an example of an edge case that is treated differently in the three primary data models that exist as W3C recommendations. The three data models are the XPath data model, the Document Object Model (DOM), and the XML information set.
The XML information set (XML infoset) is an abstract description of the data in an XML document and can be considered to be the primary data model for an XML document. The XPath data model is a tree-based model that is traversed when querying an XML document and is similar to the XML information set. The DOM precedes both data models but is also similar to both data models in a number of ways. Both the DOM and the XPath data model can be considered to be interpretations of the XML infoset.
Namespaces in the Document Object Model (DOM)
The XML
namespace section of the DOM Level 3 specification
considers namespace declarations to be regular
attribute nodes that have
http://www.w3.org/2000/xmlns/ as their namespace name
and xmlns
as their prefix or
qualified name.
Elements and attributes in the DOM have a namespace name that cannot be altered after they have been created regardless of whether their location within the document changes or not.
Namespaces in the XPath Data Model
The W3C XPath recommendation does not consider namespace declarations to be attribute nodes and does not provide access to them in that capacity. Instead, in XPath every element in an XML document has a number of namespace nodes that can be retrieved using the XPath namespace navigation axis.
Each element in the document has a unique set of namespace nodes for each namespace declaration in scope for that particular element. Namespace nodes are unique to each element in that namespace. Thus namespace nodes for two different elements that represent the same namespace declaration are not identical.
Namespaces in the XML Information Set
The XML infoset recommendation considers namespace declarations to be attribute information items.
In addition, similar to the XPath data model, each element information item in an XML document's information set has a namespace information item for each namespace that is in scope for the element.
XPath, XSLT and Namespaces
The W3C XML Path Language also known as XPath is used to address parts of an XML document and is used in a number of W3C XML technologies including XSLT, XPointer, XML Schema, and DOM Level 3. XPath uses a hierarchical addressing mechanism similar to that used in file systems and URLs to retrieve pieces of an XML document. XPath supports rudimentary manipulation of strings, numbers, and Booleans.
XPath and Namespaces
The XPath data model treats an XML document as a tree of nodes, such as element, attribute, and text nodes, where the name of each node is a combination of its local name and its namespace name (that is, its universal or expanded name).
For element and attribute nodes without namespaces, performing XPath queries is fairly straightforward. The following program, which can be used to query XML documents using the command line, shall be used to demonstrate the impact of namespaces on XPath queries.
using System.Xml.XPath;using System.Xml;
using System;
using System.IO;
class XPathQuery{
public static string PrintError(Exception e, string errStr){
if(e == null)
return errStr;
else
return PrintError(e.InnerException, errStr + e.Message );
}
public static void Main(string[] args){
if((args.Length == 0) || (args.Length % 2)!= 0){
Console.WriteLine("Usage: xpathquery source query <zero or more
prefix and namespace pairs>");
return;
}
try{
//Load the file.
XmlDocument doc = new XmlDocument();
doc.Load(args[0]);
//create prefix<->namespace mappings (if any)
XmlNamespaceManager nsMgr = new XmlNamespaceManager(doc.NameTable);
for(int i=2; i < args.Length; i+= 2)
nsMgr.AddNamespace(args[i], args[i + 1]);
//Query the document
XmlNodeList nodes = doc.SelectNodes(args[1], nsMgr);
//print output
foreach(XmlNode node in nodes)
Console.WriteLine(node.OuterXml + "\n\n");
}catch(XmlException xmle){
Console.WriteLine("ERROR: XML Parse error occured because " +
PrintError(xmle, null));
}catch(FileNotFoundException fnfe){
Console.WriteLine("ERROR: " + PrintError(fnfe, null));
}catch(XPathException xpath){
Console.WriteLine("ERROR: The following error occured while querying
the document: "
+ PrintError(xpath, null));
}catch(Exception e){
Console.WriteLine("UNEXPECTED ERROR" + PrintError(e, null));
}
}
}
Given the following XML document that does not declare any namespaces, queries are fairly straightforward as seen in the examples following the code.
<?xml version="1.0" encoding="utf-8" ?><bookstore>
<book genre="autobiography">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<book genre="novel">
<title>The Confidence Man</title>
<author>
<first-name>Herman</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
</book>
</bookstore>
Example 1
-
xpathquery.exe bookstore.xml /bookstore/book/title
Selects all the title elements that are children of the
book
element whose parent is thebookstore
element, which returns:
<title>The Autobiography of Benjamin Franklin</title>
<title>The Confidence Man</title> -
xpathquery.exe bookstore.xml //@genre
Select all the
genre
attributes in the document and returns:
genre="autobiography"
genre="novel" -
xpathquery.exe bookstore.xml //title[(../author/first-name = 'Herman')]
Selects all the titles where the author's first name is "Herman" and returns:
<title>The Confidence Man</title>
However, once namespaces are added to the mix, things are no longer as simple. The file below is identical to the original file except for the addition of namespaces and one attribute to one of the
<bookstore xmlns="urn:xmlns:25hoursaday-com:bookstore">book
elements.
<book genre="autobiography">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<bk:book genre="novel" bk:genre="fiction"
xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">
<bk:title>The Confidence Man</bk:title>
<bk:author>
<bk:first-name>Herman</bk:first-name>
<bk:last-name>Melville</bk:last-name>
</bk:author>
<bk:price>11.99</bk:price>
</bk:book>
</bookstore>
Note that the default namespace is in scope for the whole XML document, while the namespace declaration that maps the prefix
bk
to the namespace nameurn:xmlns:25hoursaday-com:bookstore
is in scope for the second book element only.
Example 2
-
xpathquery.exe bookstore.xml /bookstore/book/title
Selects all the title elements that are children of the
book
element whose parent is thebookstore
element, which returns NO RESULTS. -
xpathquery.exe bookstore.xml //@genre
Selects all the
genre
attributes in the document and returns:
genre="autobiography"
genre="novel" -
xpathquery.exe bookstore.xml //title[(../author/first-name = 'Herman')]
Selects all the titles where the author's first name is "Herman," which returns NO RESULTS.
The first query returns no results because unprefixed names in an XPath query apply to elements or attributes with no namespace. There are no
bookstore
,book
, ortitle
elements in the target document that have no namespace. The second query returns all attribute nodes that have no namespace. Although namespace declarations are in scope for both attribute nodes returned by the query, they have no namespace because namespace declarations do not apply to attributes with unprefixed names. The third query returns no results for the same reasons the first query returns no results.The way to perform namespace-aware XPath queries is to provide a prefix to namespace mapping to the XPath engine, then use those prefixes in the query. The prefixes provided do not need to be the same as the namespace to prefix mappings in the target document, and they must be non-empty prefixes.
Example 3
-
xpathquery.exe bookstore.xml /b:bookstore/b:book/b:title b urn:xmlns:25hoursaday-com:bookstore
Select all the title elements that are children of the
book
element whose parent is thebookstore
element and returns the following:
<title xmlns="urn:xmlns:25hoursaday-com:bookstore">The Autobiography of Benjamin Franklin</title>
<bk:title xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">The Confidence Man</bk:title> -
xpathquery.exe bookstore.xml //@b:genre b urn:xmlns:25hoursaday-com:bookstore
S
elects all thegenre
attributes from the "urn:xmlns:25hoursaday-com:bookstore" namespace in the document that returns:
bk:genre="fiction" -
xpathquery.exe bookstore.xml //bk:title[(../bk:author/bk:first-name = 'Herman')] bk urn:xmlns:25hoursaday-com:bookstore
Selects all the titles where the author's first name is "Herman" and returns:
<bk:title xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">The Confidence Man</bk:title>
Note This last example is the same as the previous examples but rewritten to be namespace aware.
For more information on using XPath, read Aaron Skonnard's article Addressing Infosets with XPath and view the examples at the ZVON.org XPath tutorial.
XSLT and Namespaces
The W3C XSL transformations (XSLT) recommendation describes an XML-based language for transforming XML documents into other XML documents. XSLT transformations, also known as XML style sheets, utilize patterns (XPath) to match aspects of the target document. Upon matching nodes in the target document, templates that specify the output of a successful match can be instantiated and used to transform the document.
Support for namespaces is tightly integrated into XSLT, especially since XPath is used for matching nodes in the source document. Using namespaces in your XPath expressions inside XSLT is much easier than using the DOM.
The example that follows contains:
- A program for use in executing transforms from the command line.
- An XSLT stylesheet that prints
all the
title
elements from theurn:xmlns:25hoursaday-com:bookstore
namespace in the source XML document when run against thebookstore
document from theurn:xmlns:25hoursaday-com:bookstore
namespace. - The resulting output.
Program
Imports System.Xml.XslImports System.Xml
Imports System
Imports System.IO
Class Transformer
Public Shared Function PrintError(e As Exception, errStr As String) As String
If e Is Nothing Then
Return errStr
Else
Return PrintError(e.InnerException, errStr + e.Message)
End If
End Function 'PrintError
'Entry point which delegates to C-style main Private Function
Public Overloads Shared Sub Main()
Run(System.Environment.GetCommandLineArgs())
End Sub 'Main
Overloads Public Shared Sub Run(args() As String)
If args.Length <> 2 Then
Console.WriteLine("Usage: xslt source stylesheet")
Return
End If
Try
'Create the XslTransform object.
Dim xslt As New XslTransform()
'Load the stylesheet.
xslt.Load(args(1))
'Transform the file.
Dim doc As New XmlDocument()
doc.Load(args(0))
xslt.Transform(doc, Nothing, Console.Out)
Catch xmle As XmlException
Console.WriteLine(("ERROR: XML Parse error occured because " +
PrintError(xmle, Nothing)))
Catch fnfe As FileNotFoundException
Console.WriteLine(("ERROR: " + PrintError(fnfe, Nothing)))
Catch xslte As XsltException
Console.WriteLine(("ERROR: The following error occured while
transforming the document: " + PrintError(xslte, Nothing)))
Catch e As Exception
Console.WriteLine(("UNEXPECTED ERROR" + PrintError(e, Nothing)))
End Try
End Sub
End Class 'Transformer
XSLT stylesheet
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:b="urn:xmlns:25hoursaday-com:bookstore">
<xsl:template match="b:bookstore">
<book-titles>
<xsl:apply-templates select="b:book/b:title"/>
</book-titles>
</xsl:template>
<xsl:template match="b:title">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>
Output
<?xml version="1.0" ?><book-titles xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:ext="urn:my_extensions" xmlns:b="urn:xmlns:25hoursaday-com:bookstore">
<title xmlns="urn:xmlns:25hoursaday-com:bookstore">The Autobiography of
Benjamin Franklin</title>
<bk:title xmlns="urn:xmlns:25hoursaday-com:bookstore"
xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">The Confidence
Man</bk:title>
</book-titles>
Note that the namespace declarations from the stylesheet end up on the root node of the output XML document. Also to note is the fact that the XSLT namespace is not included in the output XML document.
Generating XSLT stylesheets from the output of your XSLT transforms is slightly cumbersome because the processor has to be able to determine the output elements from the actual stylesheet directives. There are two ways I have found to deal with this issue, both of which I'll illustrate by showing stylesheets that generate the following XMLT stylesheet as output.
<xslt:stylesheet version="1.0"xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<xslt:output method="text"/>
<xslt:template match="/"><xslt:text>HELLO WORLD</xslt:text></xslt:template>
</xslt:stylesheet>
The first method involves creating a variable
containing the stylesheet to be created, and then
using value-of
in combination
with the disable-output-escaping
attribute to create the stylesheet.
<xsl:output method="xml" encoding="utf-8"/>
<xsl:variable name="stylesheet">
<xslt:stylesheet version="1.0"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<xslt:output method="text"/>
<xslt:template match="/"><xslt:text>HELLO
WORLD</xslt:text></xslt:template>
</xslt:stylesheet>
</xsl:variable>
<xsl:template match="/">
<xsl:value-of select="$stylesheet" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
This first method works best if the stylesheet being created can be easily partitioned so that it can be placed in variables. While this technique is quick and easy, it also falls into the category of gross hack, which typically tend to become unmanageable when faced with any situation requiring flexibility. For instance, when creation of the new stylesheet involves lots of dynamic creation of text and is intertwined with the stylesheet directives, the following method is preferable to the aforementioned gross hack.
<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"xmlns:alias="http://www.w3.org/1999/XSL/Transform-alias">
<xslt:output method="xml" encoding="utf-8"/>
<xslt:namespace-alias stylesheet-prefix="alias" result-prefix="xslt"/>
<xslt:template match="/">
<alias:stylesheet version="1.0">
<alias:output method="text"/>
<alias:template match="/"><alias:text>HELLO
WORLD</alias:text></alias:template>
</alias:stylesheet>
</xslt:template>
</xslt:stylesheet>
The above document uses the namespace-alias
directive to
substitute the alias
prefix
and namespace name it is bound to with the xslt
prefix and the namespace name
to which it is bound.
Namespaces are also used to specify mechanisms for
the extension of XSLT. Namespace prefixed functions
can be created that are executed in the same manner as
XSLT functions. Similarly, elements from certain
namespaces can be treated as extensions to XSLT and
executed as if they were transformation directives
like template
, copy
, value-of
, and so on. Below is an
example of a Hello World program that uses
namespace-based extension functions to print the
signature greeting.
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:newfunc="urn:my-newfunc">
<output method="text"/>
<template match="/">
<value-of select="newfunc:SayHello()" />
</template>
<msxsl:script language="JavaScript" implements-prefix="newfunc">
function SayHello() {
return "Hello World";
}
</msxsl:script>
</stylesheet>
XML Namespace Caveats
Namespaces in XML, like any useful tool, can be used improperly and have various subtleties that may cause problems if users are unaware of them. This section focuses on areas where users of XML namespaces typically have problems or face misconceptions.
Versioning and Namespaces
There are two primary mechanisms used in practice to create different versions of an XML instance document. One method is to use a version attribute on the root element as is done in XSLT, while the other method is to use the namespace name of the elements as the versioning mechanism. Versioning based on namespaces is currently very popular, especially with the W3C, who have used this mechanism for various XML technologies including SOAP, XHTML, XML Schema, and RDF. The namespace URI for documents that are versioned using the namespace is typically in the following format:
http://my.domain.example.org/product/[year/month][/area]The primary problem with versioning XML documents by altering the namespace name in subsequent versions is that it means XML namespace-aware applications that process the documents will no longer work with the documents, and will have to be upgraded. This is primarily beneficial with document formats whose versions change infrequently, but upon changing alter the semantics of elements and attributes, thus requiring that all processors no longer work with the newer versions for fear of misinterpreting them.
On the other hand, there are a number of scenarios
where an XML document versioning mechanism based on a
version attribute on the root element is
sufficient. A version attribute is primarily
beneficial when changes in the document's structure
are backwards compatible. The following situations are
all areas where using a version attribute is a
wise choice:
- Semantics of elements and attributes will not be altered.
- Changes to the document involves the addition of elements and attributes, but rarely removal.
- Interoperability between applications with various versions of the processing software is necessary.
Both versioning techniques are not mutually exclusive and can be used simultaneously. For instance, XSLT uses both a version attribute on the root element, as well as a versioned namespace URI. The version attribute is used for incremental, backwards-compatible changes to the XML document's format, while altering the namespace name is done for significant changes in the semantics of the document.
Document Types
The term document type is misleading as discussed in several philosophical debates on various XML related mailing lists . In many cases, the namespace name of the root element can be used to determine how to process the document, however, this is hardly a general rule and stating it as such violates the spirit of XML namespaces as they were designed exactly so that developers could mix and match XML vocabularies.
A succinct post that captures the essence of why thinking that root element namespace URI are equivalent to a notion of document type is this post by Rick Jelliffe on XML-DEV. The essence of the post is that there are many different types that an XML document could have, including its document type as specified by its Document Type Definition (DTD), its MIME media type, its schema definition as specified by the xsi:schemaLocation attribute, its file extension, as well as the namespace name of its root element. Thus it is quite likely that in many cases a document will have many different types depending on what perspective one decides to take when examining the document.
Two examples of XML documents in which actual document types can be misconstrued by simply looking at the namespace URI of the root element are RDDL documents (sample, notice that its root element is from the XHTML namespace) and annotated mapping schemas, which have their root element is from the W3C XML Schema namespace.
In a nutshell, the type of a document cannot conclusively be determined by looking at the namespace URI of its root element. Thinking otherwise is folly.
Namespaces Future
There are a number of developments in the XML world focused on tackling some of the issues that have developed around XML namespaces. Firstly, the current draft of the W3C XML namespaces recommendation does not provide a mechanism for undeclaring namespaces that have been mapped to a prefix. The W3C XML namespaces v1.1 working draft is intended to rectify this oversight by providing a mechanism for undeclaring prefix namespace mappings in an instance document.
The debate on what should be returned on an attempt to dereference the contents of a namespace URI has lead to contentious debate in the XML world and is currently the focus of deliberations by the W3C's Technical Architecture Group. The current version of the XML namespaces recommendation does not require the namespace URI to actually be resolvable because a namespace URI is supposed to merely be a namespace name that is used as a unique identifier, and not the location of a resource on the Internet.
Tim Bray (one of the original editors of both the XML Language and XML namespaces recommendations) has written an exhaustive treatise on the issues around namespace URIs and the namespace documents that may or may not be retrieved from them. This document contains much of the reasoning that was behind his creation of the Resource Directory Description Language (RDDL), which is designed to be used for creating namespace documents.
Helpful! (Score:5, Funny)
nail .. on .. the .. head (Score:2, Insightful)
Re:nail .. on .. the .. head (Score:1)
All the namespace crap makes it impossible
to read or write. And what good is it really?
Re:nail .. on .. the .. head (Score:3, Insightful)
Can you imagine if, say, every email address in the world belonged to the same domain? Can you imagine if every Java class in the world belonged to the same package, or if every Perl method belonged to the same module? Now imagine if every XML element in the world had to come from the same (null) namespace. When you consider the millions of people that use XML, you *will* get conflicts.
XML Namespaces is just a way to add a unique identifier to elements that happen to have the same name. <title> can mean a thousand different things, depending on whether it refers to a book, a web page, ownership of your car, or the title of "Vice President". Now if you ever want to describe both the fact that you are a Vice President and that you own a car in the same XML document, you damned well better have a way of differentiating between the two "title"s.
Is it really that hard to use anyway? All you have to do is stick an extra little xmlns="..." at the top of your document -- you don't even have to use potentially-ugly prefixes -- and it's not any worse than typeing <!DOCTYPE foo SYSTEM "..."> at the top of the page. And if you really really don't want to play in the global game and you know that none of your elements will ever cross boundries with another document type, then you can just ignore namespaces all together.
It's complex, but I'll contend that it has the most "gain" of any XML recomendation to date.
Re:nail .. on .. the .. head (Score:2)
<price currency="USD">5</price>
If you ever read any of the specifications, you would see that locale or currency issues are not even close to being handled by any part of XML. Currency is an application issue.
Re:nail .. on .. the .. head (Score:3, Interesting)
I'd argue that it's the unscientific nature of XML standards development, in particular the remarkable failure to learn from prior art such as LISP and database theory, that is responsible for this current mess.
I've never worked in an academic institution, but I know that I'd be scouring the research papers for ideas if I was responsible for an XML-related activity. Academics are quite good at synthesising ideas because they have time to look around. Pragmatics like us will just grab the first thing that works because normally it doesn't matter that much, and only in the worst case will some model be stretched completely beyond its appropriate domain. Unfortunately, this is just what's happened with XML.
Re:nail .. on .. the .. head (Score:1)
For Heaven's sake, XML is pretty much just an extraordinarily verbose way of describing tree structures. There are issues of naming, cross referencing, quotation, and grammatical correctness - none of which are hard problems (although the prevalent hack-it-and-ship-it mentality consistently screws up; we should teach more basic theory and less Java/C++/object-babble at universities...)
Duh (Score:1, Insightful)
Couldn't this be linked instead of transcribing the whole shebang here?
Re:Duh (Score:2, Informative)
They're part of the W3C.
Re:Duh (Score:1)
can't read it (Score:1, Funny)
Re:can't read it (Score:1)
Wow! (Score:5, Insightful)
.almost.
Re:Wow! (Score:5, Insightful)
Re:Wow! (Score:2, Insightful)
Slashdot has a function. Setting up the infrastructure to do tutorials et al properly would distract from its function, and likely not increase the budgeted resources it has to serve its existing function. (If it paid for itself, that'd be a point in its favor, but I don't think it would.)
Re:Wow! (Score:2)
Re:Wow! (Score:1)
Re:Wow! (Score:2)
Re:Wow! (Score:2)
I could get flamed for endorsing a commercial establishment - and, no, I don't work for them - but I've found some of the tutorial articles that IBM posts at their developerWorks website to be quite nice.
Re:Wow! (Score:1)
A system like this would do wonders for
the linux documentaion.
Knud
A secret (Score:2, Interesting)
I find it ironic that so many people here bash Microsoft when one of their employees has been one of the best contributors of original content to Slashdot. Of course, the moment Bill Gates gets a story posted here is the moment I delete /. from my bookmarks.
Re:A secret (Score:2)
The article doesn't mention just how braindead XML actually is.
It's like a religion - if you start with the premise that XML is good, then it all fits together and the article is valuable to you, but just because the article is a good report on XML doesn't mean that XML itself is any good. This is a common mistake people make,. and this article furthers MS's goals of pushing the XML-religion. The author may himself by quite clever, but, just as many reasonably intelligent people fall for religions, he may be simply misguided.
Re:Wow! (Score:1)
Whatever happened to Hyperlinking (Score:1, Flamebait)
Okay.. there is no larger public as the
Re:Whatever happened to Hyperlinking (Score:5, Funny)
Re:Whatever happened to Hyperlinking (Score:1)
If you link then you have to worry about being slashdotted, thus making it less viewable. You could, however, link to a google cache version if it has been spidered recently.
Filters... (Score:2)
So you turned on the "filter Jon Katz stories" too, huh? :-)
psxndc
Re:Whatever happened to Hyperlinking (Score:2)
Notice the underlined word above? Or perhaps it is merely blue text on the console. Whatever the case, it is a link to the full version of his article, in all it's glory, on MSDN [microsoft.com].
In other words, the full article is linked.
So your real question is why did Slashdot decide to reprint the shortened version? Maybe they were worried that if people realized this was an article put out by the Evil Empire® © 1985-2002, that their readers wouldn't read it...
(Also, anyone want to guess which is the larger audience, Slashdot or MSDN?)
Re:Whatever happened to Hyperlinking (Score:1)
It would cause a tremor in the force.
Re:Whatever happened to Hyperlinking (Score:1)
ok, bad joke.
Great in theory (Score:2, Informative)
Once de-referencing URIs is built into parsers I think namespaces (and XML in general) will be much more useful.
Mark
Re:Great in theory (Score:4, Informative)
Re:Great in theory (Score:2)
Namespaces, just a rehash of SGML (Score:2, Informative)
XML namespaces are touted as a wonderful new invention. Unfortunately they're just a non backwards compatible copy of what SGML could already do with the CONCUR declaration.
SGML already had: <(p.anthology)page> long before XML was even dreamed of.
*yawn*
--Azaroth
Very good (Score:1, Interesting)
I kindof see the point of it being a bit longish for the
How 'bout a link to a more permanant article source/website?
Re:Very good (Score:1)
You mean like the one on MSDN that he linked to?
Informative article... (Score:1)
XM Hell (Score:2, Interesting)
If the initial idea of XML/XSL was to make data protable and transformable they should have been designed with more functionality to do this.
1 good example is Binary operations, all kinds of data is store like this especially in legacy or the mainframe systems i've been working with
You can script a # to binary function but you have to use nasty itterative functions instead of loops
e.g. in sudo stuff
myfunction(somthingusefull,counter,limit){
if(counter limit){
bytepos = bytepos *2;
counter = counter +1;
dosomthingwith(somthingusefull);
myfunction(bytepos
}
}
Well i'm sure you get my drift so I'll leave it there for now.
Re:XM Hell (Score:3, Insightful)
1 good example is Binary operations, all kinds of data is store like this especially in legacy or the mainframe systems i've been working with ,but XSL provides no weasy way of formatting this data into somthing usefull./p>
XSL is a tool to transform XML documents. Of course it doesn't touch binary formats, that's outside it's scope.
OK, what's the binary analog of XSLT? (Score:1)
XSL is a tool to transform XML documents. Of course it doesn't touch binary formats, that's outside it's scope.
XSLT transforms XML into XML. So what tool transforms Everything Else into XML?
Perl. (Score:1)
Re:OK, what's the binary analog of XSLT? (Score:1)
Perl. But that would have been the answer no matter what the question :)
Re:XM Hell (Score:1)
XM Hell?
surly they should make XSL more functional first?
protable and transformable?
no weasy way?
itterative functions?
somthingusefull?
Well i'm sure you get my drift so I'll leave it there for now.
I haven't got the faintest idea what your drift might be, sorry...
Woah!! (Score:4, Funny)
Re:Woah!! (Score:1, Offtopic)
SlashDot still has a lot of good content (especially if you block Katz), but face it, we're GNU/Linux geeks. We're programmers and sysadmins at heart! We need more real *TECH* content like this!
Bryan
What's next for XML? (Score:1)
XML is a becoming a very powerful, indeed, magical language. Perhaps one day before long, it'll have forloops and a query language (oops, xpath, already exists). Why before long, we might just have a reference counting garbage collector for those XML namespaces. Then maybe a cyclicle garbage collector.
</wheelrant>
Re:What's next for XML? (Score:1)
XSLT is very procedural in nature, but While and For loops are still possible to implement if you know your logic well enough: I once wrote a sqrt function in XSLT.
Re:What's next for XML? (Score:2, Interesting)
XEXPR - A Scripting Language for XML [w3.org]
Read and weep.
Re:What's next for XML? (Score:2)
Re:What's next for XML? (Score:1)
and a query language
XML Query [w3.org] for when qpath isn't enough
Now you slashdot addicts can learn! (Score:5, Insightful)
This is the first time I've seen an article on /., as opposed to comments on one written somewhere else.
It's against Slashdot's norm -- a news site -- but I think it makes for a great idea. It lets me read a single source for both tech news and a little bleeding-edge knowledge. Although I dislike the karma whore article posting phenomenon, I love reading those articles inline.
Truth be told, this also helps flesh out a university education. Although I learned a lot in my specialist degree, I became a well-rounded and knowledgable geek only through outside interests: clicking on Slashdot links, messing with Linux, etc. Until now, I didn't think about "XML Namespaces and how they affect XPath and XSLT," but now I can discuss it with a clue.
Keep it up guys -- this improves the value of Slashdot immensely. At the very least, give this concept a section of its own (articles.slashdot.org?) with links from the main page.
P.S: Why not post some articles on argument fallacies [midnightbeach.com] and how to answer lame questions yourself. [google.com]
Another great article that marries well with this (Score:2, Funny)
From the Article:"Before COM add-ins were invented, you could only create Office application-specific add-ins (except Microsoft Outlook® and Microsoft FrontPage®). These application-specific add-ins have file extensions such as
Novel XSLT transforms (Score:1)
Can it transform Visual Basic code into something taken seriously?
Re:Novel XSLT transforms (Score:1)
No, but if you wrote XML first and then used that to generate Visual Basic, then you could at least slap on a different code generator and spit out your business logic in Perl or Java the next time around :)
Good article (Score:5, Funny)
What is it about bookstores that make them ideal for explaining how a programming language, database or markup language work? I must have seen 100 different books and online articles that describe what they are trying to teach with a bookstore as the example.
Not that I'm complaining(being that I program for a bookstore). Its just that there seems to be a disproportionate number of bookstore programming examples compared to other types of businesses. Personally, I'd like to see more manufacturing plants(hospitals, casinos, stock markets, etc).
Re:Good article (Score:5, Insightful)
For example, a book has attributes like ISBN, Title, and pages that are 1:1. It has relationships with things like publishers that are N:1 (a book has one publisher, but a publisher has many books). And it has a relationship with authors that are M:N (a book can have many authors, and an author can write many books). Just this level of detail makes it an interesting example of how to create a book database that's in 3rd normal form.
One table for book and it's main attributes like ISBN, Title, and pages. This table also has a foreign key to the publisher table. The publisher table has a primary key (pub_id) as well as name and any other main attributes you want to include (address for returns?). The author table has an author_id and the author's name. Finally, there's a book_author table that links books to authors in the required M:N way.
If you're writing an application to manage book inventory you're presented with problems like 1) how do you add books without insertion anomalies (for instance, "Catcher in the Rye" is added with author = "Salinger, J. D." and "Raise High the Roofbeam, Carpenter" is added with author = "Salinger, JD") 2) how do you prevent deletion anomalies (if you delete all books by author Foobar McTavish, do you delete the author record?) These problems raise real issues that developers need to be aware of but doesn't cloud the issue with unnecessary detail.
On the other hand, imagine the domain of an insurance company. Well, there are policies, and policies have lines of business, and lines of business have coverages. Each coverage has a rate schedule, but, of course, the schedule varies by state. And rates also have to take schedule modifications into account, as well as the experience modifications and the loss history of the insured. But, that also depends on the dollar amount of the coverage. And the policy might actually be covered by a reinsurer, rather than the primary insurer, each of whom has underwriters who manage the coverage schedule. Ouch!
As a former insurance company employee who was responsible for designing a data model for the business (and as a former bookstore employee), I wish I had stuck with the latter!
Re:Good article (Score:1)
What is it about bookstores that make them ideal for explaining how a programming language, database or markup language work?
Well, as someone who writes computer-science textbooks and professional developer books for a living (including several with multi-tier bookstores as examples) I can honestly say that there's a very simple reason: advertising. By inserting bookstore applications into every book, and by populating the application databases with the appropriate information, we can advertise all the other books we write.
Default namespaces are evil! (Score:3, Informative)
And, in my humber opinion, keeping it human readable is the main reason to use XML in the first place. As a purely data-transfer medium it is far to bulky and requires too much CPU at each end. Even HTML query strings are faster to parse and convert to binary equivalents.
For machine to machine transfer we really need a binary XML standard. My understanding is that W3C is working on such...
Jack William Bell
Re:Default namespaces are evil! (Score:1)
Perhaps the inability to undefine non-default namespaces (see the last section of the article) should be called a "wise decision" as opposed to an "oversight"?
Re:Default namespaces are evil! (Score:2)
I wouldn't call that a stupid question. It is one I have asked myself. So far as I can tell the answer is "Because some people thought it was a good idea and you don't have to use it."
True. You don't have to use GoTo either. Doesn't make GoTo less evil, even when you run into a situation where GoTo is the easiest option.
Jack William BellRe:Default namespaces are evil! (Score:1)
From the other point XML is not an inter-lingua by itself - it doesn't care about semantic. You need RDF, DAML, OIL, XML-ized Prolog and so on for it. XML is like ethernet in networks, if you will, it's on low level of system design.
One more point - binary format still requires format tagging. What's wrong with XML tags? Are they really big? I thing XML tags are same big for inter-lingua tagging as TCP packet headers. Should we cut or comprtess TCP packet headers?
i want to say thanks (Score:2, Insightful)
And the point? (Score:1, Redundant)
While the article is nice, it is referenced in the MSDN article! It is basically a rehash of that. So why not create a link or is Slashdot trying something new?
Reality check (Score:4, Insightful)
Suppose I have two systems. From system 1 I need to notify system 2 of personal data in the db that has been modified, so they can update their info.
First approach: select all persons that have been modified since last time. Write all their data to a file, one person per row, either using a fixed field width representation or a token seperated one. My C program that I wrote in 5 minutes creates the file, his Cobol program that he wrote in 1 hour reads the data, checks it and inserts it into his system.
Moron approach: Select all persons that have been modified since last time. Invent an XML schema to represent the data. Use 5 hours to write the DTD and the program the creates the XML data. Because we are feeling super-trendy, we send this by HTTP POST to (2) ala Soap.
To be cosher (2) now has to have a web server, CGI's that can handle Soap and store the parameters (in this case a file) on the file system, the ability to validate and parse the XML file, on a AS/400, no less.
Perhaps he has some helpful tools, perhaps he has to code a general XML parser himself, perhaps (more likely) he writes my name on the big list he has on the wall saying "People who *will* die".
He tries to get a XML system from the net in, say, Java, spends 5 days getting it to work, while coding the HTTP bits himself (which he does in only 40 hours. Yeah! What a coder!)
Unfortunately, his big-wigs have just been force-fed with XML propaganda, and have decided on their own, incompatible XML representation of the data... And he must write the XSL code and so forth.
(2) now moves my name, and those of his bosses, and some of the people at W3C from the "People who *will* die" list to the new "DIE DIE DIE DIEDIEDIE BLEED FUCKING PIGS!!!!!!!!!1!111!1!" list. And gets his AK-47 and goes out the door...
Net time/life cost:
Rational thinking: 1h5min
XML: 100+h plus 15 deaths and 150 wounded.
Re:Reality check (Score:2)
Re:Reality check - Fiction (Score:2, Interesting)
Lets say you have one market, and n businesses in that market. Like, say, accounting, or schools, or manufacturing. All of these entities need to interact with each other, and exchange data.
Now, they could take your approach, and create a custom excange format for every different interaction. That scales, well, not at all.
As an alternative, they could define a few formats using an identical grammar. Then all their systems could interact without having to write custom applications for each of the custom exchange formats that their accounting department escapee came up with.
Then they could fire the short-sighted hacks that "saved" all that time by not using XML in the first place.
Re:Reality check (Score:2, Interesting)
But if you're company A, and you want to send info to or exchange info with companies B1, B2,
Plus with XML-to-object-to-XML parsing/generation conventions, reading XML and accessing/manipulating the data is easy. Also, databases and surrounding IT tools have an easier time shuttling data back and forth.
For huge XML documents though, you gotta do more work, 'cause full in-memory XML-to-object isn't practical.
MSFT languages? (Score:4, Insightful)
How about an XML processing article using languages that slashdotters actually care about and write in -- Perl, PHP3, Java, C++, Python, etc.? We're not going to pop over to freshmeat and download the latest VB4Debian, you realize.
VB for Debian (Score:2)
We're not going to pop over to freshmeat and download the latest VB4Debian
Oh yes you are. GNOME Basic [freshmeat.net] is an environment compatible with many applications written in the Visual Basic programming language.
Re:MSFT languages? (Score:1)
Re:MSFT languages? (Score:2)
What makes you think that slashdotters do not care to read a good programming article just because it uses examples in a language some of them do not use? What makes you think that when they do care, they categorically refuse to use M$ implemented languages?
I have seen more jihads on Slashdot between Java-C than between C++-VisualC++, and remarkably few rants against VB (which was a broken language even by microsofties judgement).
People don't put aside information because it comes packaged in a language used by a company they don't like that much. If you want Slashdot to reject a technical article because your ideological beliefs don't let you read a few lines of code... well sir, that would be idiotic. It's not like the code will virally infect you or anything.
But if it makes you feel better: there are many in Slashdot that are interested in Mono, which would provide ample justification for you to understand C# without working for the "dark side". The same would go for VB.NET, I think, which by the way, seems like a remarkably non-broken language compared with its predecessors.
Re:MSFT languages? (Score:1)
I wrote a client side XML/XSLT database. (Score:2)
Take a look at the application here [singleclick.com]
It requires a 6.0+ browser, Netscape 6.x (or 7), IE 6.x, Mozilla 0.9.8+, or IE 5.5 if you install the updated XSLT update (better to instead just upgrade your whole browser).
Joseph Elwell.
IMHO namespace are "bolted" on XML (Score:2)
I think it's because of "backward compatibility", which is too bad, because it's obvious that they would need something like namespace to prevent clashes.
*Sigh*
this is a MSXSL tutorial, not a XSLT tutorial (Score:1)
(Project for today: write an XSLT processor that formats your hard drive.)
This whole tutorial relies on using M$'s XSLT processor; otherwise, this example won't work. Feh.
Re:this is a MSXSL tutorial, not a XSLT tutorial (Score:1)
If your XSLT processor uses VBscript, then I imagine some guy in the Philippines is figuring out right now how to format your hard drive for you via Outlook :)
Re:this is a MSXSL tutorial, not a XSLT tutorial (Score:2, Informative)
Here is the link to read at your free time: javascript [apache.org]
Re:this is a MSXSL tutorial, not a XSLT tutorial (Score:1)
I am sorry (Score:1)
SELECT * FROM books!
RDF schema and Ontology (Score:1)
Tired from semantical hard-coding? Try RDF-schema [w3.org] and ontologies [daml.org].
XML doesn't bestow intelligence (Score:2)
Adding a namespace only confuses the issue more.
Intelligent data structures don't happen by accident, and anyone who claims that XML (and by extension, namespaces) makes everything easy is a moron.
Re:Wow... (Score:2)
Hey now (Score:1)
Of course, K5 would have voted this story up, and has voted this author's stories up before. In fact, I believe he was the author of a fairly big successful cross-posted article about Microsoft .Net or some other technology.
Re:Wow... (Score:1)
Re:I wonder how long it will take... (Score:1)
Both Java and
Re:By Heavy you mean long? (Score:1)
It's an excellent tutorial. I just think it belongs on a new slash site.
Basic? Probably. Pointless? Definitely Not. (Score:2)
It's not knew, it's somewhat informative. It's very, very basic.
So what is the point?
I may be biased being the author of the article but don't think the article is pointless. As you point out XML namespaces are a basic aspect of XML yet their ramifications are not understood by many users of XML especially when it comes to interactions with other XML related technologies. My motivation for writing the article was because I kept seeing people (including supposed experts) show a fundamental lack of understanding of how XML namespaces work especially default namespaces and how the different XML data models interact and cohabit. For example the differences between the XML infoset, XPath data model and DOM are little known by many users of XML and in fact many people do not know about all 3.
Secondly, the section on namespace caveats highlight errors in thinking I've seen many experienced users of XML not just novices.
However, many people who implement XML technologies and W3C members thought that the article was worthwhile. Now it may be that you are an experienced user of XML and this article is a waste of your time and if so I apologize for the time you lost reading the article.
Thanks for your comments.
Re:Basic? Probably. Pointless? Definitely Not. (Score:1)
Re:Basic? Probably. Pointless? Definitely Not. (Score:1)
Re:Basic? Probably. Pointless? Definitely Not. (Score:1)
When I ask what's the point it is a rather vague question - to clarify I am wondering why this is on the front page of slash dot and posted in its entirety. This seems to be somewhat unusual. I don't see a lot of tutorials posted here.
I'm definitely not an XML expert but I have a good grasp of what is in your article from what little XSLT work I've done. That's what made me very curious.
I can imagine what it would be like if something on the same level were posted in regards to PERL or C.
Well - I am sure my opinion is not what will make or break your day and I appreciate that you even responded to my little
.
This is good! - was Re:By Heavy you mean long? (Score:2)
critisize on that basis!
I found it re-iterated a lot of points that I learned a year ago myself. But that doesn't mean everyone would agree. XML is still pretty new to a lot of people and anyone who reads this not knowing about XML and namespaces is going to gain a lot.
The only crtisism I have of the article is that it doesn't include enough pointers to bibliography and 'learn more here' sources like specific pages on w3c.org or other tutorials on the net. Someone who starts to understand this stuff from the article will want to have a list of resources to continue learning...
Jack William Bell
Re:This is good! - was Re:By Heavy you mean long? (Score:1)
The moderator says that there is heavy reading ahead.
I go look at it and there is nothing heavy there. But it is as long as all get out. So I make a humorous (to me anyway) remark.
Honestly tell me there is something deep or difficult to comprehend here. Yes it is informative but there is nothing that is difficult to grasp. It just lays out the rules of the road.
Here is the irony. I post the comment and figure it will go unnoticed (w/out my bonus to keep it lower). But it doesn't. Real quick it gets modded up to +5. No good to me I'm at the cap. But then sure enough - an hour or so down the road I start getting modded down - flamebait, troll, overrated, etc. So I lose points even though the mods are equivalent because I was at the cap. No big deal but kind of interesting.
What's funny too is how at first my post was informative and interesting and then later it's suddenly a troll, and I wonder if it is the editors who feel that way not the readers.
Once again - no big deal. But I'm not kidding. If we're going to start seeing extended tutorials on basic topics - I've got a few I would like to see.
Ruby stuff would be nice
Perl (don't know a thing about how to use it)
Python (just what is it - I've never touched it)
And don't tell me that beginner stuff on that would not be in the same boat as this tutorial. XML is not that new and you can't avoid tutorials, books, and web sites all about it.
I regret that I have but 50 karma points to give in defense of my opinion.
.
Karma Kap - was Re:This is good! - was ... (Score:1, Offtopic)
I never did understand the reason for the cap either -- to make all the kiddies with 20 karma feel better? But that's the way it goes...
Jack William Bell
Re:Karma Kap - was Re:This is good! - was ... (Score:1)
I'm not sure that I believe you still have 86 karma - I had karma over 50 at cap time, and it was truncated to 50. How'd you manage to avoid that?
Re:Karma Kap - was Re:This is good! - was ... (Score:1)
Hmmm... I don't know how to show you my user info. When you click on someone else's user number it doesn't show the karma. I will try to cut and paste from what it shows me. Hopefully you will believe I didn't fake it...
Welcome back Jack William Bell (84469)This is your User Info page. There are thousands more, but this one is yours. You most likely are not so interested in yourself, and probably would be more interested in the Preferences links you see up top there, where you can customize Slashdot, change your password, or just click pretty widgets to kill time.
You're a moderator with 5 points(expire after 2002-06-02). Please read the Moderator Guidelines [slashdot.org] before you do any moderation.
http://www.sff.net/people/jackb/home.htp [sff.net]
Karma 86 (mostly the sum of moderation done to users comments)jackb@sff.net [mailto]
User Bio
Computer programmer, writer, musician, artist, parent... Basically I am just a guy with no spare time.
Jack William Bell has posted 137 comments. Below find the most recent 24 comments.
1 Re:Default namespaces are evil! [slashdot.org] posted on 01:57 PM May 30th, 2002 (Score:2)
attached to XML Namespaces and How They Affect XPath and XSLT [slashdot.org]
Re:So close, yet so far: (Score:1)
nothing better to do then sit around and nitpick over obvious typos. That has nothing to do w/my remarks on the subject.
As posted below - it's a nice tutorial - if you are new to xml, xslt etc.
Anyways- sticking to my original point you are a coward as clearly stated in your post. I prefer the term pussy. And a small, small person.
feel free to help me out w/any grammar or spelling issues above as we all know that could be the very most important thing in the world.
.
Re:XML bad choice for this problem set (Score:1)
Re:XML bad choice for this problem set (Score:1)
Re:XML bad choice for this problem set (Score:1)
Re:uh, wasn't xml supposed to be... (Score:1)
It still is (well, a nice, little, uncomplicated meta-language). Namespaces, XPATH, XSL, etc etc etc are not compulsory. But it's convenient to be able to mix-n-match other pre-written XML-based languages or transform one XML document into another (like DocBook-XML to RSS to XHTML).