Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with XML / XSL

Status
Not open for further replies.

abenstex

Programmer
Jan 9, 2005
47
DE
Hi everyone,

a friend of mine asked me to help him with transforming an xml-file to html using xsl. Now i am facing one problem: The xml file is more or less like this:
Code:
<Root>
    <bla>This is a test
         <bla2>asd</bla2>
         <bla3>qwe</bla3>
    </bla>
</Root>
Now, everytime i call <xsl:value of select="bla"> it retrieves not only "This is a test" but also everything that's underneath. Is there a way to get only the content of the bla-element?
 
<xsl:template match="*"/>
would prevent any childnodes to be parsed (by default all are parsed)
 
you could try
Code:
<xsl:value-of select="bla/text()"/>
but I'm not sure what you are trying to do exactly or what XSL you already have...

 
Or set up the XML like this:
Code:
<Root>
    <bla>
         <text>This is a test</text>
         <bla2>asd</bla2>
         <bla3>qwe</bla3>
    </bla>
</Root>

Then get the text like this:
<xsl:value-of select="bla/text"/>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top