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

Re: namespace syntax

Subject: Re: namespace syntax
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 04 Aug 2009 14:44:00 +0200
Re:   namespace syntax
Robert Van Gemert wrote:

I am using msxml3 and am having difficulty parsing namespace elements, I need to get the value of the NSML fields

<mos>
<mosID>gvg.auroraplay.mos</mosID>
<ncsID>MNEWS</ncsID>
<roStorySend>
 <roID>MNEWS/TVNEWS.AUSNET.RUNDOWNS-IGNITE.AM-TWO</roID>
 <storyID>492893613</storyID>
 <storySlug>1130 AUSNET 030809</storySlug>
 <storyNum></storyNum>
 <mosExternalMetadata>
  <mosPayload>coding=3D"utf-16"?&gt;
   <nsml:nsml xmlns:nsml=3D"http://www.inewsroom.com">
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
So here the URL is http://www.inewsroom.com.

    <nsml:head>
     <nsml:meta words=3D"1" rate=3D"180" break=3D"yes"></nsml:meta>
     <nsml:rgroup number=3D"2"></nsml:rgroup>
     <nsml:wgroup number=3D"6"></nsml:wgroup>
     <nsml:formname>TVNEWS-2            </nsml:formname>
     <nsml:storyid>1d60f5ad:003b5638:4a76334b</nsml:storyid>
    </nsml:head>
    <nsml:fields>
     <nsml:f id=3D"page-number"></nsml:f>
     <nsml:f id=3D"title">1130 AUSNET 030809</nsml:f>
[snip]

My stylesheet is:

<?xml version=3D"1.0"?>
<xsl:stylesheet version=3D"1.0" =
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform" =
xmlns:nsml=3D"http://www.avid.com">
^^^^^^^^^^^^^^^^^^^
while here you use a completely different URL. You can choose a different prefix in the XML and in the stylesheet but in your stylesheet you will need to bind a prefix to the URL used in the XML if your stylesheet needs to select/match elements in that namespace. So use e.g.
xmlns:nsml="ttp://www.inewsroom.com"
in the stylesheet.


<xsl:template match=3D"/">

<xsl:for-each select=3D"//mosPayload/nsml:fields/f">

<xsl:for-each select="mos/roStorySend/mosExternalMetadata/mosPayload/nsml:nsml/nsml:fields/nsml:f">


should process the nsml:f elements in your XML input.




--


	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

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.