| |
| ||||||
Working with namespaces and namespace prefixes in XSLT 1.0This is a discussion on Working with namespaces and namespace prefixes in XSLT 1.0 within the DWH Tip Feeds forums, part of the Data Warehousing Tips and Techniques category; To whom it may concern - I'm currently developing a Xslt 1.0 stylesheet for analysis of XML Schema documents. As part of this work, I developed a couple of templates ... |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
| | #1 |
| News Bot Join Date: Nov 2007
Posts: 15,067
![]() | To whom it may concern - I'm currently developing a Xslt 1.0 stylesheet for analysis of XML Schema documents. As part of this work, I developed a couple of templates for working with namespace names and prefixes, and I like to share them via this post. The code is not incredibly hard or advanced, but it gets the job done and it may save you some time if you need something similar.
Return the local name part of a given QName. This is functionally equivalent to the fn:local-name-from-QName get-prefix Return the prefix part of a given QName. This is functionally equivalent to the fn:prefix-from-QName function in XPath 2.0 get-ns-name Return the namespace name associated to the given prefix. This is functionally equivalent to the fn:namespace-uri-for-prefix function in XPath 2.0. The main difference is that this template does the lookup against the namespace definitions that are in effect in the current context, whereas the XPath 2.0 function allows the element which is used as context to be passed in as argument. get-ns-prefix Return a prefix that can be used to denote the given namespace name. This template is complementary to the get-ns-name template. This template assumes only one prefix will be defined for each namespace. The namspace is resolved against the current context. resolve-ns-identifier Return the namespace name for a given QName prefix (be it a namespace prefix or a namspace name). This template is useful to generically obtain a namespace name when feeding it the prefix part of a QName. If the prefix happens to be a namespace name, then that is returned, but if it happens to be a namespace prefix, then a lookup is performed to return the namspace name. This template also looks at the namspaces in effect in the current context. Error: "" is neither a valid namespace prefix nor a valid namespace name. More from Roland Bouman's Blog ... |
| | |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| IT overhaul working for CBA | Latest News Headlines | Latest News | 0 | 10th February 2011 06:27 AM |
| Working from home on NBN | Latest News Headlines | Latest News | 0 | 29th July 2010 12:50 PM |
| RIM is working on a tablet too | Latest News Headlines | Other International Vendors | 0 | 23rd June 2010 02:13 AM |
| Working in Context | admin | Prediction Markets News Feeds | 0 | 12th December 2009 05:28 AM |
| open-msp-viewer: Free XSLT utilities to render MS Project files as HTML web pages | Latest News Headlines | DWH Tip Feeds | 0 | 25th November 2009 11:03 AM |
| | |
| | |