473,320 Members | 2,202 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,320 software developers and data experts.

Confusion over patterns and expressions

Lets say I have some XML like this:

<AAA>
<BBB>
<b1>xx</b1>
<b2>xxx</b2>
</BBB>
<CCC>
<c1>z</c1>
</CCC>
</AAA>

And I want to write some XSL that will process the last node of the
root element - in this case <CCC>, ignoring all other nodes - in this
case <BBB>. I don't know the element names ahead of time so I can't use
them in the templates.

So my general question is, how do I write the expressions in the
select part of the xsl:apply-template element and/or, how do I write
the match part of the pattern in the xsl:template element?

Jul 20 '05 #1
1 963

<xsl:template match="/*">
<xsl:apply-templates select="*[last()]"/>
</xsl:template>

<xsl:template match="/*/*">
whatever you want here
</xsl:template>

David
Jul 20 '05 #2

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

Similar topics

3
by: Han | last post by:
I know this is possible (because preg can do almost anything!), but can't get a handle on the syntax. I have an HTML string: <font size="3"><a...
3
by: inhahe | last post by:
Hi i'm a newbie at this and probably always will be, so don't be surprised if I don't know what i'm talking about. but I don't understand why regex look-behinds (and look-aheads) have to be...
4
by: Michael Kragh Pedersen | last post by:
Is it not possible to use ?: in your group expressions in XSLT patterns, like it is for example in JavaScript? Michael K. P.
5
by: Soren Kuula | last post by:
Hi, In XSLT1.0, are these two match expressions not supposed to match the same nodes: child::foo and foo
5
by: pmatos | last post by:
Hi all, I think I'm suffering from some confusion with polymorphic types by C++. Imagine the following example: I have the ABC fruit and then the classes Pear, Apple, Banana that inherit from...
1
by: Carlos | last post by:
Hi! I think two extensions to re could be really powerful in aiding to match non regular strings -for example those containing parens nested up to an arbitrary depth- but without a significative...
3
by: aristotelian | last post by:
I'm interested in taking the output of a daemonized shell script that greps for patterns which would act as an argument to a script. Is it better to write this stuff to file and visit the file...
10
by: Andrew Robinson | last post by:
I don't know if this is a compiler error or not. It all kind of makes sense but you would think that the compiler would check the types of the possible outcomes of the tertiary operator (c and d)...
2
by: ogo796 | last post by:
hi everyone can anyone help me with the php pattern that search the following string and get the below patterns. "2004_8.rtf" (November) S v Mimi(000/00) NAME 8; "2005_9.rtf" (November) S v...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.