XML to XML Transformation with XSLT

I have worked with XML transformations before and done so successfully but I can't figure out what I am doing wrong with this one and it should be simple. So I thought I'd reach out and throw someone a soft ball because I am sure I am going to feel stupid when someone else points out what the issue is.  The XML looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<TradeFeed xmlns="urn:tradefeed-xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Common>
		<BloombergFirmID>0000</BloombergFirmID>
		<TransactionNumber>1111111</TransactionNumber>
		<SecurityIdentifierFlag>1</SecurityIdentifierFlag>
		<SecurityIdentifier>2222222A9</SecurityIdentifier>
	</Common>
</TradeFeed>

Open in new window


Simple, right? The XSLT I put together looks like this:

<?xml version="1.0" ?>
	<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
		<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
		<xsl:template match="/">
    <TRADE>
		<BloombergFirmID><xsl:value-of select="TradeFeed/Common/BloombergFirmID"/></BloombergFirmID>
    </TRADE>
  </xsl:template>
  </xsl:stylesheet>

Open in new window


And what I get looks like this:

<?xml version="1.0" encoding="utf-8"?>
<TRADE>
  <BloombergFirmID></BloombergFirmID>
</TRADE>

Open in new window


I did try putting
<xsl:apply-templates/>
into the mix but all i got was a list of all the values in the XML document and ignoring anything after that.

Like I said this should not be that hard but I am obviously suffering from some mental lapse here so any help would be appreciated.

Thanks.
Russell Scheinberg, MCSE Data Platform 2012IT Development AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
zc2Commented:
You need an explicit declaration of the namespace (I named it "t" in the following sample), like
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="urn:tradefeed-xsd" exclude-result-prefixes="t">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
		<TRADE>
			<BloombergFirmID>
				<xsl:value-of select="t:TradeFeed/t:Common/t:BloombergFirmID"/>
			</BloombergFirmID>
		</TRADE>
	</xsl:template>
</xsl:stylesheet>

Open in new window

2

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Russell Scheinberg, MCSE Data Platform 2012IT Development AdministratorAuthor Commented:
Well that was fast and really did the trick. Thanks so much.
0
 
zc2Commented:
You are welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.