Help! The apply-templates function is not currently allowing me to
select a specific template... eventhough I tried putting a select
statement, it does not seem to work??? Can someone help show how I can
select the first template and then have it select others? Below is a
sample of the xml as well as the .xsl file when
I do something like the following in the main section it does not seem
to work, it only works when I remove the select statement, and even
then it seems to only be using the first template... any help is
greatly appreciated...
<xsl:apply-templates select="hashref/item[starts-with(@key,'TEST _')]"
/>
XSL file
--------------
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<basefont face="Verdana" size="2" />
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:key name="key-search" match="item" use="@key" />
<xsl:template match="hashref/item[starts-with(@key,'TEST _')]">
<table border="0" bgcolor="gray">
<tr>
<th colspan="2" bgcolor="navy"> <font color="white">< xsl:value-of
select="@key"/></font></th>
</tr>
<!-- output all text/control tag items -->
<xsl:for-each select="hashref/item">
<xsl:if test="text()">
<tr>
<th align="left"><x sl:value-of select="@key"/></th>
<td><font face="verdana" size="2" color="white">< xsl:value-of
select="text()"/></font></td>
</tr>
</xsl:if>
</xsl:for-each>
<!-- test results -->
<tr>
<th align="left">te st result</th>
<xsl:variable name="key_value "
select="key('ke y-search','hypoth esis_test_resul ts')"/>
<xsl:choose>
<xsl:when test="$key_valu e = 'false'">
<td><font face="verdana" size="2" color="red"><xs l:value-of
select="."/></font></td>
</xsl:when>
<xsl:otherwis e>
<td><font face="verdana" size="2" color="white">< xsl:value-of
select="."/></font></td>
</xsl:otherwise>
</xsl:choose>
</tr>
<xsl:apply-templates select="item[@key='hypothesi s_test_results']"/>
</table>
<!-- for spacing purposes between tests -->
<table border="0"><tr> <td></td></tr><tr><td></td></tr></table>
</xsl:template>
<xsl:template match="item[@key='hypothesi s_test_results']">
<tr>
<td><font face="verdana" size="2" color="red"><xs l:value-of
select="test"/></font></td>
<td><font face="verdana" size="2" color="red"><xs l:value-of
select="."/></font></td>
</tr>
</xsl:template>
<!--
<xsl:apply-templates select = 'item'/>
<xsl:template match="/item[@key='hypothesi s_result']" >
<tr>
<th align="left"><x sl:value-of select="@key"/></th>
<td><font face="verdana" size="2" color="blue"><x sl:value-of
select="."/></font></td>
</tr>
</xsl:template>
-->
</xsl:stylesheet>
XML file
--------------
<item key="TEST_5">
<hashref memory_address= "0x943c6f4" >
<item key="AccountID" >58279</item>
<item key="ScheduleID ">7</item>
<item key="ShortName" >RBCNUK-0855-CEFL</item>
<item key="hypothesis _results">
<arrayref memory_address= "0x943809c" >
<item key="0">
<arrayref memory_address= "0x943778c" >
<item key="0">
<arrayref memory_address= "0x9437744" >
<item key="0">4166</item>
</arrayref>
</item>
</arrayref>
</item>
</arrayref>
</item>
<item key="hypothesis _test_results">
<hashref memory_address= "0x943c6ac" >
<item key="result">tr ue</item>
</hashref>
</item>
<item key="sample_res ults">
<arrayref memory_address= "0x943259c" >
<item key="0">
<arrayref memory_address= "0x9432614" >
<item key="0">
<arrayref memory_address= "0x94381bc" >
<item key="0">4160</item>
</arrayref>
</item>
<item key="1">
<arrayref memory_address= "0x943241c" >
<item key="0">4153</item>
</arrayref>
</item>
<item key="2">
<arrayref memory_address= "0x9432638" >
<item key="0">4162</item>
</arrayref>
</item>
<item key="3">
<arrayref memory_address= "0x94380fc" >
<item key="0">4164</item>
</arrayref>
</item>
<item key="4">
<arrayref memory_address= "0x94381b0" >
<item key="0">4163</item>
</arrayref>
</item>
<item key="5">
<arrayref memory_address= "0x94380cc" >
<item key="0">4165</item>
</arrayref>
</item>
<item key="6">
<arrayref memory_address= "0x94381d4" >
<item key="0">4168</item>
</arrayref>
</item>
</arrayref>
</item>
</arrayref>
</item>
<item key="stats_resu lts">
<hashref memory_address= "0x943376c" >
<item key="MEAN">4162 .14285714286</item>
<item key="STD">4.740 90608177306</item>
<item key="STD_ERROR" >1.791894068783 59</item>
<item key="confidence _interval_lower ">4151</item>
<item key="confidence _interval_upper ">4173</item>
<item key="critical_v alue">5.9565</item>
<item key="degrees_of _freedom">6</item>
<item key="distributi on">tdistr</item>
<item key="interval_t ype">integer</item>
<item key="level_of_s ignificance">0. 000499999999999 972</item>
<item key="sample_siz e">7</item>
<item key="type_of_te st">two tailed test</item>
</hashref>
</item>
</hashref>
</item> 3 1642
<xsl:template match="hashref/item[starts-with(@key,'TEST _')]">
so here your current node is an item node
<xsl:apply-templates select="item[@key='hypothesi s_test_results']"/>
so this selects item children (with that attribute) of teh current item
node, but your sample input didnt have any such children, they seem to
be grandchildren below a hashref so perhaps you meant to do
<xsl:apply-templates select="hashref/item[@key='hypothesi s_test_results']"/>
David
Hi, Thanks for the response I will try that. How about when the first
<xsl:apply-templates\> is called? It seems that I cannot get this to
just apply the following template specifically... any ideas? I tried
the following but maybe something is wrong here?
statement to call template
<xsl:apply-templates select="hashref/item[starts-with(@key,'TEST _')]">\>
template to call
<xsl:template match="hashref/item[starts-with(@key,'TEST _')]">
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hi, Thanks for the response I will try that. How about when the first
<xsl:apply-templates\> is called? It seems that I cannot get this to
just apply the following template specifically... any ideas? I tried
the following but maybe something is wrong here?
you used a similar wording in your original message and I didn't
understand what you meant then or now. I suspect that you have the
wrong mental model of how xslt is working.
When you use apply-templates you _never_ specify which templates are to
be applied (and there is no real notion of a "next" template, the order
of templates in the stylesheet is not significant). apply-templates uses
a select expression which selects nodes in the input tree.
If you want to call a block of code explictly then you want to use a
named template not a match template and use xsl:call-template rather
than apply-templates. However that isn't normally what you would want to
do for this kind of transform.
David This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: yawnmoth |
last post by:
http://www.frostjedi.com/terra/dev/test.html
I'd like to have the colored boxes appear on the same line as "Test"
does. The div containing the colored boxes is defined as being inline,
yet doesn't seem to be acting as an inline element. I suspect the
floats in the images within the div may be contributing to the problem,
but I don't know...
|
by: Jim Hubbard |
last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework?
Not if you are unaware of the 1,596 issues listed at KBAlertz
(http://www.kbalertz.com/technology_3.aspx).
If you are going to use .Net......I highly recommend signing up for the free
KBAlertz newsletter at http://www.kbalertz.com/default.aspx.
Looking at all of the...
|
by: manish |
last post by:
Hi,
I am a fresher in the programming field i.e although I have done
programming at the basic level but at professional level I am very new
and I am facing many problems. These probllems are not taughtand I am
not getting any Refrences to cope with them.
********Setting in VC++ 6.0 I don'know to apply setting for
various/different ...
|
by: mb12036 |
last post by:
All-
Having a problem installing a DB2 client on a machine running AIX
version 5.0. Client appeared to install one time succesfully, then
was uninstalled and a reinstall was attempted. For some reasons, it
does not complete the reinstall. See the status report from the GUI
installer at the end of this note. Errors are towards the...
|
by: Andy K |
last post by:
Hi ,
Finally i was able to setup my replication process between two
databases .
For those who were not following my story , i was trying to setup a
replication between two databases on different linux server (RH 7.3)
for UDB 7.x .
I did the capture with a : asnccp mong warm
| |
by: Claire |
last post by:
Hi
Ive been using Mattias Sjögren's example at
http://www.msjogren.net/dotnet/eng/samples/dotnet_dynpinvoke.asp to load an
unmanaged 3rd party dll dynamically when my object is created. Calling the
"CreateDllAssembly" function below does this.
When my wrapper is disposed of, I want the dll to be unloaded from memory.
See the "dispose"...
|
by: Dales |
last post by:
I have a custom control that builds what we refer to as "Formlets"
around some content in a page. These are basically content "wrapper"
sections that are tables that have a colored header and provide an
open TD with a DIV in it for the content of this formlet. (The DIV is
for DHTML to hide and show the content)
I've created a web page...
|
by: Wescotte |
last post by:
I've wrote a little test app to use XMLHTTPRquest test app but I'm
looking to add some functionality and I'm not quite so how to go about
doing it.
Below is the source
What I'd really like is to be able to use <SPAN onClick =
"Select(this);">
where I could pass the object and not have to display the results of
|
by: Chris Lieb |
last post by:
I am trying to add an event listener to the keyup event for some text
inputs that I am creating dynamically. I have no problems getting it
to work in Firefox, but IE just ignores them. I have created a few
functions to aid in making this process work semi-cross-browser. (I
develop in FF, but everyone who uses it will be using IE6.)
...
|
by: Bethrezen |
last post by:
hi all
I have something of a quandary I'm trying to create a footer that has rounded corners
using the code on this page http://www.cssplay.co.uk/boxes/snazzy.html
I managed to get the effect I was looking for and I started filling the box with the footers contents but I’m having problems because this brakes when I try to apply a float to...
|
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...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
|
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |