xm to htm with xslt

Hi all
I have following xml file

<ObjItemResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MobComp.industry.ESBSvc">
  <ObjItem xmlns:d2p1="org.mobcomp.ch.model">
    <d2p1:Loc i:nil="true" />
    <d2p1:ObjItem i:type="d2p1:Unit">
      <d2p1:FormalAbbrdNameTxt>Org 0.5</d2p1:FormalAbbrdNameTxt>
      <d2p1:IdentificTxt>Nick 0.5</d2p1:IdentificTxt>
    </d2p1:ObjItem>
  </ObjItem>
</ObjItemResponse>

and following xslt

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:d2p1="org.mobcomp.ch.model" exclude-result-prefixes="d2p1">

<!--xsl:namespace-alias stylesheet-prefix="S" result-prefix="xsl"-->
<!--xsl:namespace-alias stylesheet-prefix="S" result-prefix="#default"/-->
<xsl:output method="html"/>
<xsl:template match="/">
      <html>
            <head><title>OBJ Item Response</title></head>
            <body>
                  <p><xsl:value-of select="/ObjItemResponse/ObjItem/d2p1:ObjItem/d2p1:FormalAbbrdNameTxt"/></p>
         </body>
        </html>
</xsl:template>
</xsl:stylesheet>

can any body tell me why I have nothing between the <p> tags
Thanks for helping out


LVL 1
thomasbau65Asked:
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.

Geert BormansInformation ArchitectCommented:
it is a namespace issue

if you really are using XSLT2, as your version indicates,
you can do this

<p><xsl:value-of select="/*:ObjItemResponse/*:ObjItem/d2p1:ObjItem/d2p1:FormalAbbrdNameTxt"/></p>

the ObjIt elements are in this namespace
xmlns="http://schemas.datacontract.org/2004/07/MobComp.industry.ESBSvc"
0

Experts Exchange Solution brought to you by

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
Geert BormansInformation ArchitectCommented:
If you need to be more precise, you can use the below approach.
That one would work in XSLT1 too (XSLT1 does not support namespace prefix wildcards)
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:d2p1="org.mobcomp.ch.model" 
    xmlns:esbs="http://schemas.datacontract.org/2004/07/MobComp.industry.ESBSvc"
    exclude-result-prefixes="d2p1 esbs">
    
    <!--xsl:namespace-alias stylesheet-prefix="S" result-prefix="xsl"-->
    <!--xsl:namespace-alias stylesheet-prefix="S" result-prefix="#default"/-->
    <xsl:output method="html"/>
    <xsl:template match="/">
        <html>
            <head><title>OBJ Item Response</title></head>
            <body>
                <p><xsl:value-of select="/esbs:ObjItemResponse/esbs:ObjItem/d2p1:ObjItem/d2p1:FormalAbbrdNameTxt"/></p>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.