473,394 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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:

<Row>
<Col Name="Col0">123456<CellColour>36</CellColour>
<FontColour>1</FontColour>
<Bottom>1</Bottom>
<Bold>False</Bold>
<Italic>False</Italic>
<TextDirection>0</TextDirection>
</Col>
</Row>

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.

Thanks.
Nov 13 '07 #1
4 2214
jkmyoung
2,057 Expert 2GB
<xsl:value-of select="Col/text()"/>
or
<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?

ie.
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
jkmyoung
2,057 Expert 2GB
Not entirely sure what you want.
Either <xsl:value-of select="Col[@name = 'Col0']/text()"/>

Or
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
Perfect!!

That was exactly what I needed.

Thanks again!!
Nov 13 '07 #5

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

Similar topics

1
by: ash | last post by:
My input file is something like this <DB> <E> <TAG1><!]></TAG1> <TAG2><!]></TAG2> <TAG3><!]></TAG3> </E> <E> <TAG1><!]></TAG1>
6
by: oooooo0000000 | last post by:
I have an XML file of varying nesting depth... <catalouge> <item id="1"> <name/> <item id="23"> <name/> <item id="55"> <name/> </item>
9
by: Stefan Franke | last post by:
Hi, I've got the following simple XSLT stylesheet, that lists all the values of the elements of any given XML file. <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0"...
9
by: gregmcmullinjr | last post by:
Hello, I am new to the concept of XSL and am looking for some assistance. Take the following XML document: <binder> <author>Greg</author> <notes> <time>11:45</time>
6
by: andyalean1 | last post by:
Hello, I am trying to match an Id number that is shared across 2 xml files.I seem to be do the right thing bu it won`t display a match.Can you please help me find my error. I have a problem matching...
0
by: napolpie | last post by:
DISCUSSION IN USER nappie writes: Hello, I'm Peter and I'm new in python codying and I'm using parsying to extract data from one meteo Arpege file. This file is long file and it's composed by...
1
by: mark4asp | last post by:
Apologies, I just can't get my head around xslt but I need to do this. I have an xml file with two attributes per product. One of the attributes repeats to produce several groups (3 in the...
1
by: Datawich | last post by:
Hi. By persistence, I've discovered that when several nested elements in a schema are each qualified by a namespace, I can successfully reference them in a select statement by qualifying each...
1
by: Hvid Hat | last post by:
Hi I want to search and replace multiple words in a text. I've got a template that does the search and replace of a word in a text. Now, I want to call this template for each word in a list of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.