Go Back   CORTEX Forums > Best Practices > Tips and Techniques > Data Warehousing Tips and Techniques > DWH Tip Feeds
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Working with namespaces and namespace prefixes in XSLT 1.0

This 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 ...


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 22nd June 2011, 11:16 AM   #1
News Bot
 
Join Date: Nov 2007
Posts: 15,067
Latest News Headlines is on a distinguished road
Post Working with namespaces and namespace prefixes in XSLT 1.0

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.
  • get-local-name: Return the local name part of a given QName. function in XPath 2.0
  • get-prefix: Return the prefix part of a given QName.
  • get-ns-name: Return the namespace name associated to the given prefix.
  • get-ns-prefix: Return a prefix that can be used to denote the given namespace name.
  • resolve-ns-identifier: Return the namespace name for a given QName prefix
get-local-name

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 ...
Latest News Headlines is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT +11. The time now is 06:51 PM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO