Translate

Image of Beginning Google Maps API 3
Image of Android Wireless Application Development
Image of Linux Kernel Development (3rd Edition)
Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

XSLT 1.0 Multiple Namespace Issues

XSLT and XPath assume that XML documents conform to the XML Namespaces recommendation whereby XML namespaces are identified by a Uniform Resource Identifier (URI). One form of a URI is a URL, e.g. http://blog.fpmurphy.com. Another form of URI is a URN, e.g. urn:biztalk-org:biszalk:biztalk_1. A namespace URI does not need to actually point to anything. Whilst in theory a namespace URI is intended to be globally unique, in practice it just needs to be unique within the local scope in which you are using it. There are two main reasons to use XML namespaces: to avoid name collisions, and to facilitate

XSL Recognizing Newlines

One of the major improvements in XSLT2 is the support for sequences as a replacement for node-sets. One of the new functions that takes advantage of this support is the the tokenize() function. The tokenize() function is equivalent to Python’s split function which takes a string and a delimiter and returns an array of the substrings that were separated by the specified delimiter(s). Perl and Ruby have an equivalent split function while Unix shells such as zsh and ksh93 provide similar functionality via different mechanisms. Consider the following trivial example (file.xml): <?xml version="1.0"?> <root> <text>line1 line2 line3 line4</text> </root> Suppose

Remove Namespaces from XML Documents

A frequent requirement when transforming XML documents is to remove some or all of a document namespaces. XML namespaces provide a simple and straightforward way to distinguish element and attribute names used in XML documents by associating them with namespaces identified by URI references. Consider the following example XML document: <work-order-list> <wo:job xmlns:wo="http:hello" freshness:timestamp="2006-01-12" xmlns:freshness="http://freshness" history:timestamp="2006" xmlns:history="http:history" xmlns:mnr="http:mnr"> <wo:work-order id="1" status="k" freshness:timestamp="2006-01-13" /> </wo:job> <wo:job xmlns:wo="http:hello" freshness:timestamp="2006-01-13" xmlns:freshness="http://freshness" history:timestamp="2006" xmlns:history="http:history" xmlns:mnr="http:mnr"> <wo:work-order id="2" status="k" freshness:timestamp="2006-01-14" /> </wo:job> <wo:job xmlns:wo="http:hello" freshness:timestamp="2006-01-14" xmlns:freshness="http://freshness" history:timestamp="2006" xmlns:history="http:history" xmlns:mnr="http:mnr"> <wo:work-order id="3" status="k" freshness:timestamp="2006-01-15" /> </wo:job> </work-order-list> It has several namespaces in it including wo, freshness,