473,387 Members | 1,318 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,387 software developers and data experts.

Simple Parent value question

I have the following XML
<root>
<Companies>
<Name>Labs</Name>
<display>Labs </display>
<val>1</val>
<Products>
<val>1</val>
<display>Maxa</display>
<CompanyKey>1</CompanyKey>
<Topics>
<val>3</val>
<display>Psychological</display>
<CompanyKey>1</CompanyKey>
<product>1</product>
</Topics>
<Topics>
<val>5</val>
<display>Finance</display>
<CompanyKey>1</CompanyKey>
<product>1</product>
</Topics>

And the following XSL

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="listboxname" />
<xsl:param name="mainTable" />
<xsl:param name="subTable" />

<xsl:template match="/">
<xsl:call-template name="main" >
<xsl:with-param name="nodes" select="child::node()"/>
</xsl:call-template>

</xsl:template>

<xsl:template name="main">
<xsl:param name="nodes"/>
<xsl:for-each select="$nodes">
<xsl:value-of select="parent::val"/>
<xsl:if test="val">
<xsl:value-of select="concat(val,'-')" />
</xsl:if>
<xsl:if test="display">
<xsl:value-of select="concat(display,'*')" />
</xsl:if>
<xsl:call-template name="main">
<xsl:with-param name="nodes" select="child::node()"/>
</xsl:call-template>
</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

The output is:

1-Labs *11-Maxa*13-Psychological*35-Finance*56-Managed Care (MSMs
Representative Only)*62-Namenda*22-Alzheimer's
Disease*23C8B03C9-44A0-4C9B-82E1-B2CD95FDC13A-Long-Term
Care*3C8B03C9-44A0-4C9B-82E1-B2CD95FDC13A652089A7-E8BC-42AB-BC75-833280AB65AF-Managed
Care*652089A7-E8BC-42AB-BC75-833280AB65AF

For <xsl:value-of select="parent::val"/>
Why does it not print the val of the parent.
For e.g. for Finance it should print 1 (val of Products) why is is
printing 3, which is the val of Psychological
Jul 20 '05 #1
0 1084

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: readytohelp | last post by:
I have the following XML <root> <Companies> <Name>Labs</Name> <display>Labs </display> <val>1</val> <Products> <val>1</val> <display>Maxa</display> <CompanyKey>1</CompanyKey>
1
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two...
13
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
17
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in...
4
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a...
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
2
by: Fendi Baba | last post by:
I created a person table with various fields such as Suffix, Salutation, etc, Some of these fields may not be mandatory for example suffix. In the actual table itself, I only have a field for...
1
by: Eric_Dexter | last post by:
I am just trying to acess a function in wordgrid (savefile) to a button that is defined in TestFrame. I can't seem to make it work I either get an error that my variable isn't global or it makes...
0
bartonc
by: bartonc | last post by:
#Boa:Dialog:DBConnectDialog import wx ##"""Given a set if login specs, create a dbServer instance and ## ensure that there is a valid, open connection to the database. ## If not, set the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.