472,371 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

xslt: multiple node match for one template: how?

I've made the following template:

<xsl:template match="form:string or form:e-mail or form:url or form:password">
[cut]
</xsl:template>

But the match attribute has an invalid xpath pattern, so i tried this:

<xsl:template match=".[node()=form:string or node()=form:e-mail or node()=form:url or node()=form:password]">
[cut]
</xsl:template>

But that too is not valid!

How should i solve this?
Jul 20 '05 #1
7 18953
> I've made the following template:

<xsl:template match="form:string or form:e-mail or form:url or form:password">
[cut]
</xsl:template>


Hi,

I think that should be:

<xsl:template match="form:string | form:e-mail | form:url | form:password">
[cut]
</xsl:template>
regards,

--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #2


Tjerk Wolterink wrote:
I've made the following template:

<xsl:template match="form:string or form:e-mail or form:url or
form:password">
[cut]
</xsl:template>

But the match attribute has an invalid xpath pattern, so i tried this:

<xsl:template match=".[node()=form:string or node()=form:e-mail or
node()=form:url or node()=form:password]">
[cut]
</xsl:template>

But that too is not valid!

How should i solve this?


Are you looking for
<xsl:template match="form:string | form:e-mail | form:url |
form:password">
maybe?

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3
Martin Honnen wrote:


Tjerk Wolterink wrote:
I've made the following template:

<xsl:template match="form:string or form:e-mail or form:url or
form:password">
[cut]
</xsl:template>

But the match attribute has an invalid xpath pattern, so i tried this:

<xsl:template match=".[node()=form:string or node()=form:e-mail or
node()=form:url or node()=form:password]">
[cut]
</xsl:template>

But that too is not valid!

How should i solve this?

Are you looking for
<xsl:template match="form:string | form:e-mail | form:url |
form:password">
maybe?


Ok that solved my problem,

but it raises a new question:

In xpath or is the or operator, why use | in xslt??

I think it has something todo with that you do not want a boolean return value from the expression in the match,
you want a node to be returned, am i right?
Jul 20 '05 #4
Ok now i have the following problem:

i've:

<xsl:template match="form:string | form:e-mail | form:url | form:password">
<xsl:if test="current()=form:password">
[cut]
</xsl:if>
</xsl:template>

But the test in the if tag does not work, how should i check wether the current() is a form:password??

name(.)='password' does not help
current()=form:password does not help

please help
Jul 20 '05 #5
> In xpath or is the or operator, why use | in xslt??

I think it has something todo with that you do not want a boolean return value from the expression in the match,
you want a node to be returned, am i right?

you're right

the '|' is the union operator for node-sets, while 'or' and 'and' does boolean logic (they return not node-set but a boolean value)
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #6
> <xsl:template match="form:string | form:e-mail | form:url | form:password">
<xsl:if test="current()=form:password">
[cut]
</xsl:if>
</xsl:template>

But the test in the if tag does not work, how should i check wether the current() is a form:password??


Normally, you test something like that with 'self::node'.
But I'm not sure how to handle the namespace. one guess: 'self::form:password'

--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #7

use | not or
or is an Xpath boolean operator an XSLT patterns have to match nodes not
boolean values.

David
Jul 20 '05 #8

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

Similar topics

0
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron...
5
by: Ruthless | last post by:
hello. All XML and XSLT are processed by preprocessor as a trees. How can i simply display my XML as some kind of tree. given xml: <struct> <node level="1" no="1">
4
by: cyclops | last post by:
I'm trying to do XML + XSLT -> Another XML. The source XML contains multiple namespaces and XSLT will handle all possible tags under each name space. ----source---- <document xmlns="..."...
6
by: Neal | last post by:
Hi All, I used an article on XSLT and XML and creating a TOC written on the MSDN CodeCorner. ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/dncodecorn/html/corner042699.htm However, it did'nt...
12
by: das | last post by:
Hello all, I am using .NET XSLT to transform an XML into another XML file. All this is fine with small files, but when tested with big files (30MB) it is taking between 1hr-2hrs to just transform...
18
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...
8
by: Hercules Dev. | last post by:
Hi all, I'm new in xslt and xpath, so my question might be simple but i'm learning. I have an XML document and need to transform it into another XML, I use xslt and it works, but there is a...
3
by: abhishek.smu | last post by:
Given an XML like: <root> <node>8</node> <node>21</node> <node>-7</node> <node>13</node> <node>43</node> <node>2</node> </root>
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.