473,785 Members | 2,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Basic XSLT question - processing result tree?

LW
I'm using the following free implementation of an XSLT "split" function,
as a template:

http://www.exslt.org/str/functions/s...plate.xsl.html

Basically, it allows me to call it like this...

<xsl:call-template name="str:split ">
<xsl:with-param name="string" select="string( 'boy,cat,dog')" />
<xsl:with-param name="pattern" select="string( ',')" />
</xsl:call-template>

....and it returns the following node...

<token>boy</token>
<token>cat</token>
<token>dog</token>

Works like a charm, but how do I take that node of <token>'s and do
further processing on it? For instance, I'd like to convert that into...

<word num="1">boy</word>
<word num="2">cat</word>
<word num="3">dog</word>

I'd prefer to avoid editing the str:split template directly, because it'd
be best if that were left generic as it is.

Seems to me I'm missing something profoundly basic here. Thanks in advance
for any help.

LW
Jul 20 '05 #1
1 3621

"LW" <la************ ******@yahoo.co m> wrote in message
news:pa******** *************** *****@yahoo.com ...
I'm using the following free implementation of an XSLT "split" function,
as a template:

http://www.exslt.org/str/functions/s...plate.xsl.html

Basically, it allows me to call it like this...

<xsl:call-template name="str:split ">
<xsl:with-param name="string" select="string( 'boy,cat,dog')" />
<xsl:with-param name="pattern" select="string( ',')" />
</xsl:call-template>

...and it returns the following node...

<token>boy</token>
<token>cat</token>
<token>dog</token>

Works like a charm, but how do I take that node of <token>'s and do
further processing on it? For instance, I'd like to convert that into...

<word num="1">boy</word>
<word num="2">cat</word>
<word num="3">dog</word>

I'd prefer to avoid editing the str:split template directly, because it'd
be best if that were left generic as it is.

Seems to me I'm missing something profoundly basic here. Thanks in advance
for any help.

Use:

<xsl:variable name="rtfSplits ">
<xsl:call-template name="str:split ">
<xsl:with-param name="string" select="string( 'boy,cat,dog')" />
<xsl:with-param name="pattern" select="string( ',')" />
</xsl:call-template>
</xsl:variable>

<xsl:variable name="vSplits" select="xxx:nod e-set($rtfSplits) ">

And then process $vSplits/* as a regular node-set.

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

Jul 20 '05 #2

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

Similar topics

0
2712
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 extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the same XML file with XSL file with a program called XMLspy and i obtained the desire and waited...
9
4256
by: Christian Roth | last post by:
Hello, when using this "identity" processing sheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="iso-8859-1" /> <xsl:template match="@*|node()">
3
2143
by: Justine Hlista | last post by:
I'm using xalan-j_2_6_0 and trying to get an example from Michael Kay's book to work: <xsl:template match="/"> <xsl:variable name="rainbow"> <color>red</color> <color>blue</color> <color>green</color> </xsl:variable>
4
8119
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="..." xmlns:a="..." xmlns:b=""> .... ----XSLT---- ....
1
1313
by: jwalton | last post by:
Sorry if slightly off-topic, but I have asked / researched many other places already, maybe someone here can help? MSIE has a useful (for users applications) feature of performing XSLT transformations if a stylesheet is specified in the XML file, e.g., within the data file: <?xml version="1.0"?> <?xml-stylesheet type='text/xsl' href='test.xsl'?> ....
3
2010
by: thomas.porschberg | last post by:
Hi, I want to read records from a database and export it in an arbitrary format. My idea was to feed a class with a String array fetched from the database and let this class fire SAX events as processor input. The basic class hierarchy is:
5
2045
by: Newbie | last post by:
The answer to this is probably obvious, but I'm somewhat new to XSLT and can't find it. I need to sort a set of nodes within a document, e.g. <A> <B/> <C> <D>3</D> <D>2</D>
18
2087
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 look up what each feature depends on and gerenate a text file. For example, in the following file, I would like to find out feature A depends on A1 and A2 and feature B depends on B1 and B2. And write that to a text file.
0
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
Oralloy
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...
0
10153
jinu1996
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...
1
10093
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,...
0
8976
agi2029
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...
1
7500
isladogs
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...
0
6740
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();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.