473,804 Members | 3,894 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Xslt defining the third object from current

200 New Member
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 2366
jkmyoung
2,057 Recognized Expert Top Contributor
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 New Member
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
2830
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 example. Here's my XML file: <?xml version="1.0"?> <!DOCTYPE para PUBLIC "-//Norman Walsh//DTD Website Full V2.4.0//EN" "http://docbook.sourceforge.net/release/website/2.4.0/website-full.dtd"
6
2936
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 this, and came across a problem that I haven't been able to solve elegantly. The problem is to find "linker" vertexes that a pair of verteces from a pre-defined set. For example, if the graph verteces represent cities and edges represent flights...
12
3421
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 apply-templates and passes a node set to it. This template in turn defines approximately 15 variables that dictate how the following template should proceed. Pseudo example: <!-- Root transformation called via .NET XSLTransform()--> <xsl:template...
1
2745
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 consuming. I keep getting the following error when I submit my email to their site. System.Xml.Xsl.XslTransformException: Cannot find the script or external object that implements prefix 'ext:MailingList'. at...
18
2090
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 look up what each feature depends on and gerenate a text file. For example, in the following file, I would like to find out feature A depends on A1 and A2 and feature B depends on B1 and B2. And write that to a text file.
4
4317
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 to use a prefix for the shared namespace, thus making the document smaller and easier to read. This worked in .NET 1.1 with no problem, but now appears to be broken in 2.0. When you try to do this, the following XslTransformException is...
2
1754
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. Justin Johansson Adelaide, South Australia +++ A horse with no name is called Lambda +++
3
11939
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 results. I'm assuming this is because the xsl:for-each-group is defining my group and not allowing the ifs to break it apart? -------------------- Here's a sample of my XML, there are about 1200 entries of Student's, so here's one: <Census> <Student...
0
9589
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9163
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
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 we have to send another system

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.