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

Xslt defining the third object from current

200 100+
Hi, I don't know xml.
The stylesheet identifies all the objects from DB & as it reads through the DB, it checks the next object "for-each", I need to check the third object as well & define within var being "nextNode3"

I need to specify in the stylesheet to look for the next column – so that I can insert the xml.
This is the code that checks/defines for current & next, with the next being "nextNode"
Expand|Select|Wrap|Line Numbers
  1.       <xsl:for-each select="Activity/ObjectGroup[@type='default']/Object">    
  2.       <xsl:sort select="@index" data-type="number" /> 
  3.       <xsl:variable name="index" select="@index" />
  4.       <xsl:variable name="nextNode" select="../Object[ @index > $index ][1]" />
  5.       <xsl:variable name="nextCol" select="$nextNode/@columnNo" /> 
  6.       <xsl:variable name="vis" select="string(Attributes/Attribute[ @name='visible'])" />
  7.       <xsl:variable name="visNextCol" select="string($nextNode/Attributes/Attribute[ @name='visible'])" />
  8.  
nextNode specifies the next object & nextCol specifies the next objects column
Now I just need to specify the 3rd object
This is what i tried - unsuccessful
Expand|Select|Wrap|Line Numbers
  1.     <xsl:variable name="nextNode3" select="../Object[ @index > $index ][2]" /> 
  2.     <xsl:variable name="nextCol3" select="$nextNode3/@columnNo" />
  3.     <xsl:variable name="visNextCol3" select="string($nextNode3/Attributes/Attribute[ @name='visible'])" />   
  4.  
Please Assist, Not too sure

Regards
Feb 13 '09 #1
2 2346
jkmyoung
2,057 Expert 2GB
Could you post a sample of your source xml? It's hard to see why it's not working, eg your code looks correct from what I can see.
Feb 13 '09 #2
ismailc
200 100+
Hi, Thank You for the assist

I'm only editing an existing xslt file and have no experience in xml.
The current file allows for 2 objects to be next to one another on one row when object2 column no = 2. I want to add a third object to the row when column no = 3, but i can't determine the 3rd object, on one row = object1, object2, object3

This is the code of the original xslt file, code in bold is what I added.

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2.  
  3. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:asp="remove" xmlns:igchart="remove" xmlns:igsch="remove" xmlns:igtxt="remove">
  4. <xsl:output omit-xml-declaration = "yes" />
  5. <xsl:template match="/">
  6. <xsl:for-each select="Activity/ObjectGroup[@type='default']/Object"> 
  7. <xsl:sort select="@index" data-type="number" /> 
  8. <xsl:variable name="index" select="@index" />
  9. <xsl:variable name="nextNode" select="../Object[ @index > $index ][1]" />
  10. <xsl:variable name="nextCol" select="$nextNode/@columnNo" />
  11.  
  12. <xsl:variable name="nextNode3" select="../Object[ @index > $index ][3]" />
  13. <xsl:variable name="nextCol3" select="$nextNode3/@columnNo" />
  14. <xsl:variable name="visNextCol3" select="string($nextNode3/Attributes/Attribute[ @name='visible'])" />
  15.  
  16. <xsl:variable name="vis" select="string(Attributes/Attribute[ @name='visible'])" />
  17. <xsl:variable name="visNextCol" select="string($nextNode/Attributes/Attribute[ @name='visible'])" />
  18.  
  19. <xsl:if test="($vis != 'False') or ($nextCol = '2' and ($vis != 'False' or $visNextCol != 'False')) or ($nextCol3 = '3')">
  20.  
  21. <xsl:if test="(@columnNo != '2')">
  22.   <tr>
  23.        <xsl:if test="($nextCol = '2') and $visNextCol != 'False'">
  24.           <tr>
  25.        </xsl:if>
  26.       <xsl:if test="($nextCol3 = '3') and $visNextCol3 != 'False'">
  27.          <tr>
  28.        </xsl:if>
  29.  
  30. </xsl:if>
  31. </xsl:if>
It gives me an error, the third object is already used by another control

Please help, Regards
Feb 16 '09 #3

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

Similar topics

6
by: Vincent Lefevre | last post by:
I would like to know if the base URI considered to resolve an unparsed entity defined by a relative URI should be the URI before or after its rewriting due to a possible catalog. Let's take an...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
12
by: Keith Chadwick | last post by:
I have a fairly hefty XSLT file that for the sake of debugging and clarity I wish to split into some separate sub-templates contained within the same file. The master template calls an...
1
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML so that editing was very easy and less time...
18
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to...
4
by: =?Utf-8?B?REZC?= | last post by:
Within an XSLT transformation, I'm trying to switch the default namespace within a section of the generated XML document to a shared namespace. This way, the content of this section does not have...
2
by: Justin Johansson | last post by:
Hello all, Would anybody be interested in looking at my attempt to Haskellize XSLT (in XSLT/XPath2, of course)? I'm looking for some informed feedback before I jump in and SourceForge it. ...
3
by: JamesDelaney | last post by:
Hello All, I'm new to XSLT and XML, so please excuse the basic question. I'm trying to apply a number of conditional xsl:if statements to xsl:for-each-group, but it does not filter out the...
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:
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.