473,472 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XSLT : hierarchy recursive problem...help

2 New Member
Dear Experts,

I have some problems with XSLT recursivity...
here what I want to do


XML:

Expand|Select|Wrap|Line Numbers
  1. <root>
  2. <Customer>
  3. <TPanel id="TPanel1">
  4. <TPanel id="TPanel2">
  5. <TcxLabel id="TcxLabel3">Any Text</TcxLabel>
  6. <TcxCheckComboBox id="TcxCheckComboBox4">
  7. <option>Check1</option>
  8. <option>Check2</option>
  9. </TcxCheckComboBox>
  10. </TPanel>
  11. <TPanel id="TPanel5">
  12. <TPanel id="TPanel6"/>
  13. </TPanel>
  14. </TPanel>
  15. </Customer>
  16. </root>
html result: (identity hierarchy)
TPanel = DIV
TcxCheckComboBox = SELECT
TcxLabel = P


Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <DIV id="TPanel1">
  3. <DIV id="TPanel2">
  4. <P id="TcxLabel3">ANY Text From Node</P>
  5. <SELECT id="TcxCheckComboBox4">
  6. <option>Check1</option>
  7. <option>Check2</option>
  8. </SELECT>
  9. </DIV>
  10. <DIV id="TPanel5">
  11. <DIV id="TPanel6"/>
  12. </DIV>
  13. </DIV>
  14. </body>
If anyone has samples of xsl code ...

thanks very much
Aug 29 '11 #1
2 2564
Mike Przygoda
2 New Member
i have probing and found the answer

But... can i use the for-each for the SELECT Option Tags???
plz help

Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="/">
  2. <body>
  3. <xsl:apply-templates/>
  4. </body>
  5. </xsl:template>
  6.  
  7. <xsl:template match="TPanel" name="div">
  8. <div>
  9.  <xsl:attribute name="id">
  10.   <xsl:value-of select="./@id"/>
  11.  </xsl:attribute>
  12.  <xsl:apply-templates/> <!--recursion-->
  13. </div>
  14. </xsl:template>
  15.  
  16. <xsl:template match="TcxLabel" name="p">
  17. <p>
  18.  <xsl:attribute name="id">
  19.   <xsl:value-of select="./@id"/>
  20.  </xsl:attribute>
  21. </p>
  22. </xsl:template>
  23.  
  24. <xsl:template match="TcxCheckComboBox" name="cb">
  25. <select>
  26.  <xsl:attribute name="id">
  27.   <xsl:value-of select="./@id"/>
  28.  </xsl:attribute>            
  29. </select>
  30. </xsl:template>
  31.  
Aug 30 '11 #2
Dormilich
8,658 Recognized Expert Moderator Expert
sure you can use <xsl:for-each> on the <option> tags, though keep in mind that you correctly define the <option>s you want to loop over.

depending on the exact transformation, an <xsl:template> might work as well.
Aug 30 '11 #3

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

Similar topics

9
by: JP SIngh | last post by:
Hi All I am trying to write a recursive function to list the managers and his employees in a tree like sctructure Manager 1 Emp1 Emp1.1 Emp 1.2 Emp 2
2
by: poofpoof | last post by:
Dear Experts, I have some problems with XSLT recursivity... here what I want to do XML part : ---------- <struct>
1
by: timothy ma and constance lee | last post by:
Sir I am using the recursive template to generate the dynamic drop down list as below: <xsl:template name="generateDropdown"> <xsl:param name="length" /> <xsl:param name="refrid" />...
2
by: Gunne | last post by:
I need to divide my XML data into 4 columns. The LinkCategory name need to be shown as header and then the LinkName(s) that belong to the LinkCategory underneath. Please help me with an XSLT...
2
by: | last post by:
OK: Purpose: Using user's input and 3 recursive functions, construct an hour glass figure. Main can only have user input, loops and function calls. Recursive function 1 takes input and displays...
0
by: pr33tz | last post by:
Hi all, I have the following XSL file: <xsl:template match="/"> <HTML> <BODY> <font face="Arial" size="4">Purchase Order Details</font> <xsl:apply-templates />
0
by: thygremlin | last post by:
Hi everyone, I have come by a challenge.... I have the following XML file, which represents expressions with "+" and "*" artihmentic operands: <m value="10"> <i value="5"/> <m...
1
by: rxgmoral | last post by:
dll problem,help me:) i create dll project ,the dll is Use MFC in a Static Library i hope exe call ListCtrl class from dll ==================DLL====================...
3
by: jzdoh | last post by:
I am trying to write a stored procedure that could create a table called tblManagerHierarchy. It is a table that contains recursive data. The data is coming from tblEmployee where it contains that...
3
by: NatRoger | last post by:
Hi, We are using DB2 V7 (MVS) in our shop, which dont have the luxury of the 'WITH clause' - CTE support to accomplish recursive queries. Here is my problem - Table1 From-ID To-ID A1 ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.