Hi,
I am trying to figure out how to see if any of a given set of childnodes equals a given string. For example, in the XML and XSL code below, I want the text in the "xsl:when" statement to output when any of the childnodes of <FormulaValue > equal the string "Value". How can I do this?? I am trying to use XPath code but I can't get it to work.
Thank you!!
Christine
XSL code: -
<?xml version="1.0"?>
-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
<xsl:template match="/">
-
<html>
-
<body>
-
<xsl:for-each select="RecipeElement/Steps/Step/FormulaValue">
-
<xsl:choose>
-
<xsl:when test="name(child::node()[3])=Value">
-
<d>Value is present</d>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:for-each>
-
</body>
-
</html>
-
</xsl:template>
-
</xsl:stylesheet>
-
XML code: -
<?xml version="1.0" encoding="UTF-8"?>
-
<?xml-stylesheet type="text/xsl" href="stylesheet13.xsl"?>
-
<RecipeElement>
-
<RecipeElementID>UFDF_CLEANING</RecipeElementID>
-
<Steps>
-
<InitialStep XPos="700" YPos="100">
-
<Name>INITIALSTEP:1</Name>
-
</InitialStep>
-
<TerminalStep XPos="800" YPos="1098">
-
<Name>TERMINALSTEP:1</Name>
-
</TerminalStep>
-
-
<Step XPos="600" YPos="598" AcquireUnit="true">
-
<Name>UFDF_CLEANING:1</Name>
-
<StepRecipeID>UFDF_CLEANING</StepRecipeID>
-
<UnitAlias>UFDF_CLEANING:1</UnitAlias>
-
<FormulaValue>
-
<Name>PUMP_SPEED</Name>
-
<Display>false</Display>
-
<Value />
-
<Real>5</Real>
-
<EngineeringUnits />
-
</FormulaValue>
-
</Step>
-
</Steps>
-
</RecipeElement>
-
1 7075 Dököll 2,364
Recognized Expert Top Contributor
Hi,
I am trying to figure out how to see if any of a given set of childnodes equals a given string. For example, in the XML and XSL code below, I want the text in the "xsl:when" statement to output when any of the childnodes of <FormulaValue > equal the string "Value". How can I do this?? I am trying to use XPath code but I can't get it to work.
Thank you!!
Christine
XSL code: -
<?xml version="1.0"?>
-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
<xsl:template match="/">
-
<html>
-
<body>
-
<xsl:for-each select="RecipeElement/Steps/Step/FormulaValue">
-
<xsl:choose>
-
<xsl:when test="name(child::node()[3])=Value">
-
<d>Value is present</d>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:for-each>
-
</body>
-
</html>
-
</xsl:template>
-
</xsl:stylesheet>
-
XML code: -
<?xml version="1.0" encoding="UTF-8"?>
-
<?xml-stylesheet type="text/xsl" href="stylesheet13.xsl"?>
-
<RecipeElement>
-
<RecipeElementID>UFDF_CLEANING</RecipeElementID>
-
<Steps>
-
<InitialStep XPos="700" YPos="100">
-
<Name>INITIALSTEP:1</Name>
-
</InitialStep>
-
<TerminalStep XPos="800" YPos="1098">
-
<Name>TERMINALSTEP:1</Name>
-
</TerminalStep>
-
-
<Step XPos="600" YPos="598" AcquireUnit="true">
-
<Name>UFDF_CLEANING:1</Name>
-
<StepRecipeID>UFDF_CLEANING</StepRecipeID>
-
<UnitAlias>UFDF_CLEANING:1</UnitAlias>
-
<FormulaValue>
-
<Name>PUMP_SPEED</Name>
-
<Display>false</Display>
-
<Value />
-
<Real>5</Real>
-
<EngineeringUnits />
-
</FormulaValue>
-
</Step>
-
</Steps>
-
</RecipeElement>
Hello, Christine!
I am going to refer you to a wonderful link for the time being, see what you can pull up, find examples there: http://www.w3schools.com/default.asp Sign in to post your reply or Sign up for a free account.
Similar topics |
by: discomiller |
last post by:
Mario Mueller:
Hello *,
radiobuttons belong to other radiobuttons by the "name="any_value""
attribut.
Thats a fakt.
I got the following XML:
**************************************************************
|
by: mike |
last post by:
I am have a problem with my xslt test.
<data>
<struct_id>34</struct_id>
<par_struct_id>0</par_struct_id>
<chd_struct_id>41</chd_struct_id>
</data>
..
..
..
|
by: n_o_s_p_a__m |
last post by:
My xml doc has many <title></title> and <title> in it, meaning the
nodes have no content (although some do). How can I test for this?
I tried title (doesn't work)
I tried //title (doesn't work)
I tried //title (doesn't work)
I tried //title (doesn't work)
Any suggestions welcome.
|
by: Scott M. Lyon |
last post by:
I'm trying to figure out the best way (considering there could be instances
where I get a lot of data in this XML, and I want to minimize any slowdowns)
to extract the value of one particular node from an XML string (not saved as
a file, but passed as a string from another module).
For example, let's assume I get back XML in a string that...
|
by: SHC |
last post by:
Hi all,
I created an application from the Console Application (.NET) of VC++ .NET
2003, and I did "Build" the application of the attached .cpp file,
volcanoes.xml and geology.dtd on my VC++ .NET 2003 - Windows XP Pro PC
suscessfully. But when I ran it from the command line - C:\Documents and
Settings\SHC\My Documents\Visual Studio...
| |
by: Kathy Burke |
last post by:
Hi, I'm using
Dim xDoc as XmlDocument
Dim xElem As xmlElement = xDoc("xpath")
I then assign a variable to a value from the result node:
Dim r As String = xElem.Attributes.GetNamedItem("name").Value
This works fine unless there is no node returned, then I get an "object
reference not set" error.
|
by: Dica |
last post by:
hi all
first off, i'm not trying to cross post, but couldn't find this newsgroup
earlier (got here from a recommendation on microsoft.public.vb, where i
originally posted this question).
anyhow, i'm just getting into .Net and am trying to parse a document, but
not able to read the values for the nodes consistently. anybody know what
i'm...
|
by: Peter Michaux |
last post by:
Hi,
I want to know the name of an object's constructor function as a
string. Something like this
<script type="text/javascript">
function Foo(){};
var a = new Foo();
alert('"' +
a.constructor.toString().match(/function\s*(+)/)
|
by: daniel.bron |
last post by:
Hello,
Given a XML document, an XPath to a leaf node, and a string value, what
is the briefest XSLT transform to change that node's value to the
given string? The node is unique, unrepeated, and guaranteed to exist.
The real life scenario is an application's configuration file. I want
to extract a particular config parameter, do some...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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: 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: 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...
|
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: 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...
| |