471,873 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Extract nested data from XML via XSLT

I am trying to extract just a portion of data from an XML data source:

<Col Name="Col0">123456<CellColour>36</CellColour>

When I extract the Col field I get "1234563612111FalsexlCenterxlBottomFalse00Fals e" using " <xsl:value-of select="Col"/>".

I just want the first portion of data "123456". I do not need any of the html tags or html data.

Any suggestions? Any direction on this would be greatly appreciated.

Nov 13 '07 #1
4 2178
2,057 Expert 2GB
<xsl:value-of select="Col/text()"/>
<xsl:value-of select="Col/text()[1]"/>
Nov 13 '07 #2
That worked great!!. Thanks

One more question to extend your reply..

Each set is named "<Col Name="Col0">123456". How do I reference them by name?

Col Name="Col0">123456
Col Name="Col1">456789
Col Name="Col2">678912
Col Name="Col3">234565

Meaning each has its own name Col0, Col1, Col2, etc.

When using Col/text() it pulls only the first Col0 as that is the tag of the data set. I already have a loop setup which now grabs the first Col/text() in each set. I how do I pull them by name?
Nov 13 '07 #3
2,057 Expert 2GB
Not entirely sure what you want.
Either <xsl:value-of select="Col[@name = 'Col0']/text()"/>

Expand|Select|Wrap|Line Numbers
  1. <xsl:for-each select="Col">
  2.   <xsl:value-of select="@name"/>:<xsl:value-of select="text()"/>
  3. </xsl:for-each>
Nov 13 '07 #4

That was exactly what I needed.

Thanks again!!
Nov 13 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by ash | last post: by
6 posts views Thread by oooooo0000000 | last post: by
9 posts views Thread by Stefan Franke | last post: by
9 posts views Thread by gregmcmullinjr | last post: by
6 posts views Thread by andyalean1 | last post: by
reply views Thread by napolpie | last post: by
1 post views Thread by Hvid Hat | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.