Hi,
I have a stylesheet with an accumulator like this
<xsl:param name="new-x">
<xsl:for-each select="anode">
<mynode>
<xsl:attribut e name="attr">
<xsl:value select="anode/atag" />
</xsl:attribute>
</mynode>
</xsl:for-each>
<xsl:copy-of select="$x" />
</xsl:param>
if I test with
<print-x>
<xsl:copy-of select="$new-x" />
</print-x>
i get the expected output:
<print-x>
<mynode attr="foo1" />
<mynode attr="foo2" />
<mynode attr="foo3" />
</print-x>
but later in the same template
count($new-x) returns 1
and
<xsl:for-each select="$new-x">
<xsl-value-of select="@attr" />
</xsl:for-each>
returns an empty result...
Some tips ?
I use xsltproc under debian sid. 4 2022
Hi, I have a stylesheet with an accumulator like this
<xsl:param name="new-x"> <xsl:for-each select="anode"> <mynode> <xsl:attribut e name="attr"> <xsl:value select="anode/atag" /> </xsl:attribute> </mynode> </xsl:for-each> <xsl:copy-of select="$x" /> </xsl:param> [snip] but later in the same template
count($new-x) returns 1
With most transformation engines that would actually cause an error -
because $new-x contains an RTF (result tree fragment) but the count()
function takes a node-set as an argument. So it looks like your
transformation engine, xsltproc, is doing automatic RTF to node-set
conversions.
Assuming that it is the case (that automatic RTF to node-set conversions are
occuring) then a result of 1 would be correct. This is because an RTF, like
an XML document, has a single root node.
Therefore, if you try...
<xsl:value-of select="count($ new-x/*)"/>
or...
<xsl:value-of select="count($ new-x/mynode)"/>
you will most likely get the result you expect.
Also...
<xsl:for-each select="$new-x"> <xsl-value-of select="@attr" /> </xsl:for-each>
You probably want...
<xsl:for-each select="$new-x/*">
or...
<xsl:for-each select="$new-x/mynode">
Hope this helps
Marrow http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger) http://www.topxml.com/Xselerator
"Jean-Christophe Michel" <jc************ **@online.fr> wrote in message
news:pa******** *************** *****@online.fr ... Hi,
I have a stylesheet with an accumulator like this
<xsl:param name="new-x"> <xsl:for-each select="anode"> <mynode> <xsl:attribut e name="attr"> <xsl:value select="anode/atag" /> </xsl:attribute> </mynode> </xsl:for-each> <xsl:copy-of select="$x" /> </xsl:param>
if I test with <print-x> <xsl:copy-of select="$new-x" /> </print-x>
i get the expected output:
<print-x> <mynode attr="foo1" /> <mynode attr="foo2" /> <mynode attr="foo3" /> </print-x>
but later in the same template
count($new-x) returns 1
and
<xsl:for-each select="$new-x"> <xsl-value-of select="@attr" /> </xsl:for-each>
returns an empty result...
Some tips ?
I use xsltproc under debian sid.
On Sun, 13 Jul 2003 08:27:57 +0100, Marrow wrote: With most transformation engines that would actually cause an error - because $new-x contains an RTF (result tree fragment) but the count() function takes a node-set as an argument. So it looks like your transformation engine, xsltproc, is doing automatic RTF to node-set conversions.
Assuming that it is the case (that automatic RTF to node-set conversions are occuring) then a result of 1 would be correct. This is because an RTF, like an XML document, has a single root node.
Therefore, if you try... <xsl:value-of select="count($ new-x/*)"/> or... <xsl:value-of select="count($ new-x/mynode)"/>
you will most likely get the result you expect.
No... i thought if it, but i only get
XPath error Invalid type in count($new-x/*)
or
XPath error Invalid type in count($new-x/mynode) Also...
<xsl:for-each select="$new-x"> <xsl-value-of select="@attr" /> </xsl:for-each>
You probably want... <xsl:for-each select="$new-x/*"> or...
<xsl:for-each select="$new-x/mynode">
I tried all this; even a
<xsl:call-template name="another" select="$new-x" />
or
<xsl:apply-templates select="$new-x" />
with
<xsl:template match="mynode" >
but in the 'another' template i cannot do more.
I think it's very strange to be able to place some xml into a param but
not being able to parse it later as real xml :(
said differently, this distinction between node-set and result tree
fragment seems to me like weak point of xsl; i cannot see its advantage.
I'll have to output the param content in a temp file then call a second
xsl :(
Hi,
In that case your transformatin engine is not, after all, performing
automatic RTF to node-set conversions. In which case...
<xsl:value-of select="count($ new-x)"/>
should cause an error.
Anyway, as you are dealing with an RTF...
In most transformation engines they supply an extension function (e.g.
xxx:node-set() or xxx:nodeset() etc.) that allow you to convert an RTF to a
node-set. You will have to check the documentation for your transformation
engine. I think it's very strange to be able to place some xml into a param but not being able to parse it later as real xml :( said differently, this distinction between node-set and result tree fragment seems to me like weak point of xsl; i cannot see its advantage.
Probably the reason that the whole concept of RTFs has gone in XSLT 2.0 ;)
Cheers
Marrow
"Jean-Christophe Michel" <jc************ **@online.fr> wrote in message
news:pa******** *************** *****@online.fr ... On Sun, 13 Jul 2003 08:27:57 +0100, Marrow wrote: With most transformation engines that would actually cause an error - because $new-x contains an RTF (result tree fragment) but the count() function takes a node-set as an argument. So it looks like your transformation engine, xsltproc, is doing automatic RTF to node-set conversions.
Assuming that it is the case (that automatic RTF to node-set conversions are occuring) then a result of 1 would be correct. This is because an RTF, like an XML document, has a single root node.
Therefore, if you try... <xsl:value-of select="count($ new-x/*)"/> or... <xsl:value-of select="count($ new-x/mynode)"/>
you will most likely get the result you expect.
No... i thought if it, but i only get
XPath error Invalid type in count($new-x/*) or XPath error Invalid type in count($new-x/mynode)
Also...
<xsl:for-each select="$new-x"> <xsl-value-of select="@attr" /> </xsl:for-each>
You probably want... <xsl:for-each select="$new-x/*"> or...
<xsl:for-each select="$new-x/mynode">
I tried all this; even a <xsl:call-template name="another" select="$new-x" /> or <xsl:apply-templates select="$new-x" /> with <xsl:template match="mynode" >
but in the 'another' template i cannot do more.
I think it's very strange to be able to place some xml into a param but not being able to parse it later as real xml :( said differently, this distinction between node-set and result tree fragment seems to me like weak point of xsl; i cannot see its advantage.
I'll have to output the param content in a temp file then call a second xsl :(
On Sun, 13 Jul 2003 10:03:16 +0100, Marrow wrote: Hi,
In that case your transformatin engine is not, after all, performing automatic RTF to node-set conversions. In which case... <xsl:value-of select="count($ new-x)"/> should cause an error.
Strange, but it doesn't :-)
Anyway, as you are dealing with an RTF...
In most transformation engines they supply an extension function (e.g. xxx:node-set() or xxx:nodeset() etc.) that allow you to convert an RTF to a node-set. You will have to check the documentation for your transformation engine.
It' xsltproc, based on libxslt (for Gnome), but no mention of this...
Thanks, i could use it with the name space
xmlls:exslt="ht tp://exslt.org/common"
then call exslt:node-set($myparam)
in all expressions. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Carl Ogawa |
last post by:
The following will stop to open test.pl due to using param('userid') and
param('pwd').
Is there an alternative way to get data from HTML file to CGI file? I have
to do this in the particular situation.
-------- html file ---------
<form name = "form3" action = "http://localhost/scripts/test.pl" method =
post>
Name: <INPUT TYPE = text NAME = "userid" size=25 value="OGAWA"><p>
Password: <INPUT TYPE = password NAME = "pwd" size=12 ><p>...
|
by: ipg |
last post by:
I am running into issues passing a parameter (that is a XML string)
into a stylesheet and using msxsl:node-set to parse the string. Can
someone please explain why.
my html:
var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.3.0");
xsl.async = false;
xsl.load("campaignHtml.xsl");
var template = new ActiveXObject("MSXML2.XSLTemplate");
template.stylesheet = xsl;
|
by: Kevin |
last post by:
I know this has probably been discussed many times before (I found
answers when I searched yesterday), but I still can't get it to
work...
I have an attribute @OID that can contain any characters (including
" and ')
I have java code using Xerces to select a node based on it's @OID
attribute using an XPath like this:
|
by: kurt hansen |
last post by:
hi
I thought that this would be easy, but maybe not so much.
I want to:
pass an xpath expression and a string value to a stylesheet
and
copy the source xml document, changing the value of the node described
by the xpath expression, to the new value.
|
by: aman.coe |
last post by:
hello all
Consider this xml file:
<root>
<body>
<ElementX id="X1" Xproperty="X_Default_Value" />
<ElementX id="X2" />
</body>
</root>
| |
by: chriscomer |
last post by:
I have successfully setup numerous xmlpoke statements within an Nant
script but this specific situation I cannot figure out. I am including
a section of the xml code I am trying to access and update using an
xmlpoke statement. No matter what I try I continue to get "
No matching nodes were found with XPath
expression '/log
gingDistributorConfiguration/xmlSerializerSection/enterpriseLibrary.loggingDistributorSettings'.
Below is the...
|
by: QTR |
last post by:
Hello,
I discovered a strange XSLT behaviour on Weblo 8.1. Let me explain it
(see at the end my example XSLT):
I call a template (1) with one parameter (A) which calls another
template (2) with two parameters. The first parameter is param A
(obtained from template 1) and the second param comes from another
template (3) which just returns the given param (C).
The second template receives 2 params (A and C) and prints them out.
Thus, in...
|
by: Andy |
last post by:
Hi, why does with-param fail to send parameters to any templates in a
stylesheet that also accepts arguments from the ASP.NET XML control?
The argument from the XML control seems to be available to any template
in the stylesheet, even if a parameter for the argument is NOT coded
for a template call.
On the other hand, any parameters coded for a template call don't seem
to pass their values (the stylesheet doesn't crash - everything is...
|
by: junkblog747 |
last post by:
What will the expression "/.." in the attribute select="/.." return?
I just inherited a huge stylesheet to maintain which has a lot of
parameters such as
<xsl:param name="myParam" select="/.."/>.
And then there is a lot of conditional processing based on this
parameter. I stepped thru the code with a debugger in Oxygen and saw
that the param is always empty (0 nodes selected).
I am trying to figure what the original author of the...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |