473,327 Members | 2,016 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,327 software developers and data experts.

XSL : How to get particular node value of a table

My XML Code

Expand|Select|Wrap|Line Numbers
  1.  <DBE:Attribute name="Test1" type="Table">
  2.       <DBE:Table>
  3.          <DBE:TableHeader>
  4.             <DBE:TableColumn>t1</DBE:TableColumn>
  5.             <DBE:TableColumn>t2</DBE:TableColumn>
  6.             <DBE:TableColumn>t3</DBE:TableColumn>
  7.             <DBE:TableColumn>t4</DBE:TableColumn>
  8.             <DBE:TableColumn>t5</DBE:TableColumn>
  9.             <DBE:TableColumn>t6</DBE:TableColumn>
  10.             <DBE:TableColumn>t7</DBE:TableColumn>
  11.             <DBE:TableColumn>t8</DBE:TableColumn>
  12.             <DBE:TableColumn>t9</DBE:TableColumn>
  13.             <DBE:TableColumn>t10</DBE:TableColumn>
  14.             <DBE:TableColumn>t11</DBE:TableColumn>
  15.             <DBE:TableColumn>t12</DBE:TableColumn>
  16.             <DBE:TableColumn>t13</DBE:TableColumn>
  17.          </DBE:TableHeader>
  18.          <DBE:TableRow>
  19.             <DBE:TableData>0300 </DBE:TableData>
  20.             <DBE:TableData/>
  21.             <DBE:TableData>25</DBE:TableData>
  22.             <DBE:TableData>25</DBE:TableData>
  23.             <DBE:TableData>2009/09/03</DBE:TableData>
  24.             <DBE:TableData/>
  25.             <DBE:TableData>BAG</DBE:TableData>
  26.             <DBE:TableData>rrr</DBE:TableData>
  27.             <DBE:TableData>Yes</DBE:TableData>
  28.             <DBE:TableData>12</DBE:TableData>
  29.             <DBE:TableData>2009/03/09</DBE:TableData>
  30.             <DBE:TableData>GO</DBE:TableData>
  31.             <DBE:TableData/>
  32.          </DBE:TableRow>
  33.       </DBE:Table>
  34.    </DBE:Attribute>
  35.  
I would like my output to be ->
t7 t5 t1 t13 --> Header
---------------------------------------------------------------
BAG 2009/09/03 0300 GO --> ROW1
.................................................. ............ --> ROW2

and so on

My XSL code --> (for only selected values to be displayed)
Expand|Select|Wrap|Line Numbers
  1.                <xsl:for-each select="DBE:Attribute[@name='Test1']/DBE:Table/DBE:TableRow">
  2.               <tr bgcolor="white">
  3.                       <xsl:for-each select="DBE:TableData">
  4.                  <td>
  5.         <xsl:value-of select="node()|*">
  6.  
  7.                 </xsl:value-of> 
  8.              </td>
  9.               </xsl:for-each>
  10.               </tr>
  11.            </xsl:for-each>
  12.  
Sep 15 '09 #1
2 2956
Sample for your reference:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <xsl:stylesheet  version="2.0"
  3.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4.     xmlns:DBE="http://schemas.microsoft.com/office/word/2003/wordml">
  5.     <xsl:template match="*">
  6.         <xsl:copy>
  7.             <xsl:copy-of select="@*"/>
  8.             <xsl:apply-templates/>
  9.         </xsl:copy>
  10.     </xsl:template>
  11.     <xsl:template match="DBE:TableRow">
  12.         <tr>
  13.             <xsl:for-each select="child::DBE:TableData[count(preceding-sibling::DBE:TableData)+1=7]">
  14.                 <td>
  15.                     <xsl:apply-templates/>
  16.                 </td>
  17.             </xsl:for-each>
  18.             <xsl:for-each select="child::DBE:TableData[count(preceding-sibling::DBE:TableData)+1=5]">
  19.                 <td>
  20.                     <xsl:apply-templates/>
  21.                 </td>
  22.             </xsl:for-each>
  23.             <xsl:for-each select="child::DBE:TableData[count(preceding-sibling::DBE:TableData)+1=1]">
  24.                 <td>
  25.                     <xsl:apply-templates/>
  26.                 </td>
  27.             </xsl:for-each>
  28.             <xsl:for-each select="child::DBE:TableData[count(preceding-sibling::DBE:TableData)+1=12]">
  29.                 <td>
  30.                     <xsl:apply-templates/>
  31.                 </td>
  32.             </xsl:for-each>
  33.         </tr>
  34.     </xsl:template>
  35. </xsl:stylesheet>
Sep 16 '09 #2
I applied the logic shared by you...and got the expected values.


Thanks a lot.!!!
It worked....................
Sep 16 '09 #3

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

Similar topics

0
by: Ex-Em-El | last post by:
let say i have this xml file : xml: <?xml version="1.0" standalone="yes"?> <aaa> <ppp> <po> <co>c</co> <do>int</do>
1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
12
by: pillepop2003 | last post by:
Hey! Can anyone give me a hint, how this problem is best implemented: I have a table of users (see below), where every user has one "superior user" (= parent node), this should be a fully...
8
by: Ryan Stewart | last post by:
Putting the following code in a page seems to make it go into an infinite loop unless you give it a very simple node to work with. Either that or it's very very slow. I'm somewhat new to this,...
2
by: thomasamillergoogle | last post by:
Hi, As you can see from the code below I have a simple js function called getFormElementsinTableRow(rowName). rowName is the ID of the tableRow. I just want to use js to find the child ID's of all...
3
by: Scott M. Lyon | last post by:
I'm trying to figure out the best way (considering there could be instances where I get a lot of data in this XML, and I want to minimize any slowdowns) to extract the value of one particular node...
0
by: HP17 | last post by:
Hi all, I am a bit desperate already trying to display a XML file using XSLT. I create a table and use <xsl:for-each> to extract every element node. This is working fine. What I want now is so...
20
omerbutt
by: omerbutt | last post by:
hi there i am making an application in which i have to populate columns that consist of some textfields and some input boxes the problem is at the mozilla's end, it creates a new node and appends the...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.