f

#### XSLT: concatenating selected text nodes

in XSLT, if I want to concatenate _all_ the child text nodes, I can just do

<xsl:value-of select=".">

however, if I want to select and concatente only _some_ of the text nodes.
for instance

<xsl:value-of select=".//foo/text()">

this doesn't work as it just takes the first element in the node set. Is
there any way of achieving this without using <xsl:for-each> to explicitly
loop round them all?

TIA

Andy


 0
ajfish (411)
1/10/2005 9:46:29 AM
comp.text.xml 8781 articles. 0 followers.

2 Replies
798 Views

Similar Articles

[PageSpeed] 18

use copy-of not value-of

David

 0
davidc5020 (601)
1/10/2005 10:39:07 AM
"David Carlisle" <davidc@nag.co.uk> wrote in message
news:yg4r7ktpnzq.fsf@penguin.nag.co.uk...
>
> use copy-of not value-of
>

worked a treat - thanks david.

>
> David


 0
ajfish (411)
1/10/2005 11:57:22 AM

Similar Artilces:

XSLT Select nodes without text-node children whose names starts with specifix text
Question on XSL expression Got this XML: <Body> <Page> <Line no="9" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="10" detail="true"> <onefield>onefieldstext</onefield> <fgman9>fgmanfieldstext</fgman9> <twofield>twofieldstext</twofield> </Line> <Line no="11" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="12" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="13" detail="true"> <onefield>onefieldstext</onefield> <fgman5>fgmanfieldstext</fgman5> <twofield>twofieldstext</twofield> </Line> <Line no="14" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> </Page> </Body> I would select the <Line/> nodes without text-node children whose names is starting with "fgman" - in this example it is all <Line/> _except_ <fgman9/> and <fgman5/> in <Line/> with @no of 10 and 13. I know that this works: &...

text + text
What is "text + text" supposed to do right now? It doesn't seem very useful to me. What about making "text + text" as an equivalent for "text || text"? Most strongly-typed programming languages do this. And MS SQL Server too, I think (CMIIW). -- dave ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond: > What is "text + text" supposed to do right now? Nothing. > What about making "text + text" as an equivalent for "text > || text"? Most strongly-typed programming languages do this. And MS SQL > Server too, I think (CMIIW). What would this gain except for bloat? It's not like SQL is utterly compatible with any programming language; users will still have to learn all the operators anyway. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match Peter Eisentraut wrote: >>What is "text + text" supposed to do right now? > > Nothing. Then are these bugs? (7.4.5 and 8.0.0beta1 give same results). Frankly, the current behaviour is quite strange to me. ------------------ =...

text-text
Wondering how what I input to my UTF-8 terminal gets passed along through my patched [1] trn ... Cyrillic: А Б В Г Д Е Ж З И Й К Л М Н О П а б в г д е ж з и й к л м н о п IPA: ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ [1] https://groups.google.com/d/msg/comp.sys.raspberry-pi/7Z37Hdrm0DM/6aqD-reXFzAJ ...

How to select all texts of the document of the format of the selected text?
Hi,i have selected a text of the document with the specified font face, color and size in MS Word 2000. Now , I want to select all the relevant texts from the entire document with the same format(face,color and size) as of the selected text. so Is there any method or shortcut to do this op.? Not really. You have to "walk" the document checking the styles as you go along. And You have to watch out for cases where the style changes in the middle of a word (!) and code accordingly to get the desired results. chetan26nov@gmail.com wrote: > Hi,i have selected a text of the documen...

Text bind command not selecting text
I am putting together a small report editor and need some help with the following problem. I would like the user to type in some text and then later be able to select either all of it or a portion of it for formatting (ie. centering, bold, italic,etc.) by typing in a command like Ctrl-A. The following code is what I came up for this process but for some reason the text does not get selected. Can someone tell why this code doesn't work? ################################################################ # use strict ; use Tk ; use Tk::NoteBook ; my $fTab ; my$mw = MainW...

Deleting selected text from text area
I was wondering if anyone could help. I'm trying to find how to delete text from a selected text Area. I'm a beginner in Java Netbeans. So go easy! This is what I tried but its not happening. int start = 0, end = 1; while ( start < end ) { start = SpeechText.getSelectionStart(); end = SpeechText.getSelectionEnd(); if ( start != end ) remove( SpeechText.getText() ); } tom79l@googlemail.com wrote: > I was wondering if anyone could help. I'm trying to find how to > delete text from a selected text Area. > > I'm a beginn...

XML DOM: XML/XHTML inside a text node
In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '&lt;', '>' becomes '&gt;'). I want to be able to override this behavior cleanly. I know I could pipe the input through a SAX parser and create nodes to insert into the tree, but that seems kind of messy. Is there a better way? Thanks. On Thu, 2 Nov 2005 noahlt@gmail.com wrote: > In my program, I get input from the us...

xslt help needed with element nodes embedded in text node
I'm but an amateur with xsl stylesheets. I need some help to the output of text nodes with embedded element nodes like the following: <uf><ns>This</ns> example</uf> <uf>Another <ns>This</ns> example</uf> <uf>Another <ns>This</ns></uf> I need to output the ns strings in italics. <xsl:apply-templates select="./uf" /> <xsl:template match="ns"> <i><xsl:value-of select="." /></i> </xsl:template> As long as the xml file is exported in lines as above the output is ok: "This example". (In this email I don't indicate the italicised part string.) But lately the document server hosting the application that contains xml files of the sort above changed the export of xml files. Now there are line breaks at each new element boundary: <uf> <ns>This</> example </uf> With my xsl code I get an additional space at the beginning and the end of the phrase: " This example ". I tried to get rid of them with <xsl:template match="text()"> <xsl:value-of select="normalize-space()" /> </xsl:template> But this results in "Thisexample". What is to be done? (There is no option to substitute the mandatory spaces with &#160;). Volker I tried <xsl:strip-space elements="uf" />. It doesn't help either. Volker Volker Le...

file command: "XML document text" vs "XML document text"
I've just used the file command on four files of RDF-XML with the following output: augtfidf.rdf: XML document text kyoto.rdf: XML document text stuff.rdf: XML document text tfidf.rdf: XML document text What does it mean that one of them has an extra space between "XML" and "document"? -- The kid's a hot prospect. He's got a good head for merchandising, an agent who can take you downtown and one of the best urine samples I've seen in a long time. [Dead Kennedys t-shirt] On 16.10.2012 16:06, Adam Funk wrote: > I've just used the file command on four files of RDF-XML with the > following output: > > augtfidf.rdf: XML document text > kyoto.rdf: XML document text > stuff.rdf: XML document text > tfidf.rdf: XML document text > > What does it mean that one of them has an extra space between "XML" > and "document"? Hard to tell without further information. What does file *.rdf | od -c show you? Janis Janis Papanagnou wrote: > On 16.10.2012 16:06, Adam Funk wrote: >> I've just used the file command on four files of RDF-XML with the >> following output: >> >> augtfidf.rdf: XML document text >> kyoto.rdf: XML document text >> stuff.rdf: XML document text >> tfidf.rdf: XML document text >> >> What does it mean that one ...

How do I 'SELECT All' text in a text box
I want to select all text in a multi line text box from a command butten. Thank for help Dave Try this... Private Sub Command1_Click() With Text1 .SelStart = 0 .SelLength = Len(.Text) .SetFocus End With End Sub Rick - MVP "Dave" <last2try@earthlink.net> wrote in message news:fo0b90h0j9imbvntdea3uu2mefth5teufr@4ax.com... > I want to select all text in a multi line text box from a command > butten. > > Thank for help > Dave ...

How to get selected text from a text edit control?
I created a text edit control using CreateEditTextControl. I can get the current text by calling char buf[256]; Size textSize = 0; GetControlData(controlRef, kControlEditTextPart, kControlEditTextTextTag, 255, buf, &textSize); but how do I get only the text that is currently selected (highlighted)? thanks, Shai In article <1111086224.345185.78280@g14g2000cwa.googlegroups.com>, shai@waves.com wrote: > I created a text edit control using CreateEditTextControl. > I can get the current text by calling > > char buf[256]; > Size textSize = 0; ...

Using Control-a to select all text in a text widget
I'm having a difficult time binding Control-a so it selects all the text in a widget just like the default Control-/ binding does. I've tried: ..t bind <Control-a> [.t bind <Control-/>] But [.t bind <Control-/>] returns nothing. If I do: ..t bind <Control-/> {puts "Selecting all"} ..t bind <Control-a> [.t bind <Control-/>] When I hit Control-/ I get at the prompt "Selecting all" and all the text is selected. But when I hit Control-a all I get is the "Selecting all" at the prompt and no text is selected. I've also tried: ..t bind <Control-a> {.t tag add sel 1.0 end} And that doesn't work either. In fact, with this code if you do Control-/ and then Control-a it unselects everything. And dumping the tags for the entire region show the tagon/tagoff for sel are gone. Does anyone know the semantics of Control-/? There's got to be more to it. - Ian I've just found this thread: http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/5c1df73696e94962/38ec894e32bafcd2?lnk=gst&q=select+all&rnum=8#38ec894e32bafcd2 Which seems to suggest there's nothing fancy about Control-/. - Ian And to answer my own question, the following works: bind .t <Control-a> {%W tag add sel 1.0 end; break;} - Ian On Wed, 01 Aug 2007 16:54:06 -0000, sniff.scratch@gmail.com wrote: >I'm having a difficult time binding Control-a so it selects all the >text in a w...

Confusing behavior regarding selected text in a text widget
Greetings one and all, I am having trouble understanding how lines of text that have been "selected" in a text widget are placed in the clipboard. Here's what's happening. I have a text widget that contains only lines of text. Some of the lines are covered by a tag that makes them invisible to the user. Specifically, if ".t" is a text widget, I have defined the tag "hide_tag": .t tag configure hide_tag -elide 1 and apply it from start of line through end of line. If one then "selects" lines of text that contain these "invisible" lines and copies them to the clipboard using control-C, all selected lines show up in the clipboard, including the "invisible" ones. I understand why this is happening and, in hindsight, I should have anticipated it, but nonetheless, it is undesirable behavior and needs to be fixed in my application. I've attempted to fix this by binding a proc to the <<Copy>> virtual event and having that proc copy all selected text that is not "invisible" to the clipboard using "clipboard clear" and "clipboard append" commands. Although the proc appears to do the correct thing, i.e., excludes the "invisible" lines, nonetheless, all selected lines, even the "invisible" ones, still appear in the clipboard. Something's going on here and I don't know what it is! Can anyone help? I have attached below example code ...

extracting text from an XML node
Hi, suppose i get the simple xml sample: <foo> 1 <bar>2</bar> 3 </foo> Now suppose i want to extract all the text of only the 'foo' node, ie expected result is '1 3'. I tried both <xsl:template match="foo"> <xsl:value-of select="text()" /> </xsl:template> and <xsl:template match="foo"> <xsl:value-of select="." /> </xsl:template> but the former lead to '1' and the latter to '1 2 3' (using xsltproc & firefox). What did i missed ? thanks, -Nicolas nicolas.edel@gmail.com wrote: > Now suppose i want to extract all the text of only the 'foo' node That isn't a built-in concept; you have to recast it as "all the text nodes which are immediate children of the 'foo' node". (The built-in text value of an element, as you discovered, is the value of all text contained in it, directly or indirectly). Note too that the whitespace (line breaks and indentation) will be part of the the text nodes unless you explicitly strip that away. <xsl:value-of select="text()" /> didn't work because value-of returns the contents of only the first matching node. This is one case where xsl:for-each is appropriate, to explicitly iterate through the text children. -- Joe Kesselman / Beware the fury of a patient man. -- John Dryden On Nov 30, 12:34 am, Joseph Kesselman <kesh...

Getting kind of abstract text snippets from text nodes
Hi everybody, I am about implementing a little search engine that searches a phrase over xml text nodes. I got that all working fine but what I want as the results is not the complete text of the textnode, I would like to make an abstract like result list (such output that you get with google searches. For eg .... I am the <b>substring</b> from a complete text node ... where "substring" is the search term. The problem is simple (I think): I want to extract all the text parts of the complete text node, where search searchterm is highlighted, surrounded by the text like 30 characters. I found an intersting post "cut down text" which is almost that what I am looking for, but there the text is just trimmed by x characters. Is anybody here, that has an "elegant" way to solve that or some hints that get me to the solution? I am not able to use regex (would be nice though) My parser is Sablotron so I am restricted to the functions that I get. (1.0). Any help is greatly appreciated. regards, Andreas W Wylach Think about dividing the text into three parts: before your target, the target itself, and after the target. Process each appropriately. If you want to report multiple instances within the same block of text, look at the standard examples of recursive text processing. -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry "Andreas W. Wylach" <aw@ioc...

Pages
I have a titel-textfield over a pic (headline) , text is black, background for text transparent. A second textfield should overlapp the first textline..... When i arrange the second field with the same settings like the first, the first text disappear... How can i do, that the second text overpapps the first, all over the pic. Any help appreciated! Thanks for replies! I am german and hope that the engish speaking people understand my problem! Soory! Gerd In article <611db9e2-b085-4fe5-907a-ca714b0c32dd@m74g2000hsh.googlegroups.com>, hurlebaus <gerd.schenk@freenet.de> wrote:...

concatenating multiple text files into one text file
Hello all, I have a huge number of text files like : spectrum1_300_315.csv spectrum1_315_331.csv spectrum1_331_364.csv spectrum1_364_386.csv spectrum1_386_401.csv ...................................... ....................................... each file contains some headerlines at the beginning and data in 2 columns. I want to concatenate the data of the files into one text file .Can anyone hel me pls?thank u in advance. ...

select dom text nodes
Hi, I want to select all the text nodes of an xml document using msxml dom. I tried using the selectNodes method with "//#text" argument. But it fails. Can anybody help please? Thank you. On Apr 13, 11:22 am, avs...@gmail.com wrote: > I want to select all the text nodes of an xml document > using msxml dom. I tried using the selectNodes method > with "//#text" argument. I don't believe there's a selectNodes() method in the W3C DOM specs. Assuming it accepts an XPath expression as an argument, what you need is '//text()'. #text is a nodeName, and is fairly meaningless in the context. Consider reading some sort of XPath tutorial, because invoking magic without understanding how it works is a recipe for disaster, as I can attest from painful personal experiences. -- Pavel Lepin Hey.. Thank you very much. That worked!! I m using MSXML and there is a selectNodes method. Yes, I agree that reading throughly before attempting a task is always the best way to work on something. Once in a while we all come across tasks where we dont have enough time to be thoroughly trained before attempting something. To be fair to me :-), I did go thru the material in MSDN on XPath. Most of it is given in the context of XSLT. That partly obstructed my learning. Inspite of that, I didnt find any reference to selecting all text nodes. After you pointed out, I did check the w3schools tutorial where I found a similar point documented, thanks to you...

XSLT Delimited Text Node
Is there a way in XSLT to match on numbers that are delimited by a character or space in a text node? Mike King wrote: > Is there a way in XSLT to match on numbers that are delimited by a character > or space in a text node? XSLT 2.0 can do that nicely with the tokenize XPath 2.0 function e.g. with the input being <?xml version="1.0" encoding="UTF-8"?> <root> <data-list>1 2 3 4 5</data-list> </root> and the stylesheet <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes" /> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> </xsl:template> <xsl:template match="data-list"> <xsl:copy> <xsl:for-each select="tokenize(., '\s+')"> <data><xsl:value-of select="." /></data> </xsl:for-each> </xsl:copy> </xsl:template> </xsl:stylesheet> the result using Saxon 8.3 is <?xml version="1.0" encoding="UTF-8"?> <root> <data-list> <data>1</data> <data>2</data> <data>3</data> <data>4</dat...

XSLT Extract Text from Nodes

Text from required text box to read-only text box
Hello, I am fairly new to JavaScript and its use in Acrobat Professional. My situation is this: I have a form with a text box field which is required for the user to enter his/her name. I would like the required text box to display the name in all caps. I also need the user's name to appear in a read-only text box later in the form, which I would like to have the first letter of the user's first, middle initial, and last names to be capitalized. I would also like to have all required fields on the form highlighted in yellow, but the highlighting not printed. Lastly, I would like the...

Surrounding text with text
I was wondering if it was possible to surround a text body with text like so: +--------------+ |ABCDEFGHIJKLM | |H N| |A Main Body O| |L Text goes P| |B here Q| |-=+_ZYXWVUTSR | | | | | | | | | +--------------+ This seems far-fetched, but just curious. I suppose that I could just move stuff around by hand in the GIMP later on, but there's probably a {better,more {extensible,clean}} way of doing it from (La)TeX. -FreeSmith ptjm@interlog.com (Patrick TJ McPhee) wrote in message news:<bffbhe$per$1@news.eusc.inter.net>... > Peter Flynn had an example like that, which he either posted here or > posted a link here. It was something to do with a certificate -- try > searching for his name and that word in google. > > It wouldn't be hard to do with metapost. I have a macro called `pathalong' > which puts text along an arbitrary path. Well, it's been a while, but I finally finished it. It's a little job I was doing for an upcoming wedding. At any rate, I used pstricks to make the text go along a path, along with a couple of hacks for sizing (from graphicx) and kerning along the line (from soul). Here's the code (don't laugh): CAUTION:THIS CODE MAY MAKE YOU WRETCH ---SNIP--- \documentclass{article} \usepackage{graphicx} \usepackage{pstricks,pst-text,nopageno} \usepackage[width=8.5in]{geometry} \usepackage{soul} \begin{document} \thispagestyle{empty} \set...

text node has text but won't render
This renders in Firefox perfectly well but the text in the red box remains invisible. The program is a subset of a larger and doesn't do much. but even after cutting out all the unneccessary stuf, I still can't get it to work!! Cheers, Greg =================== <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" > <xhtml:head> <xhtml:title> Intermingled XHTML and SVG </xhtml:title> <xhtml:script type="text/javascript" language="JavaScript"><![CDATA[ function gogo(evt){ var targetObj = evt.target; //The object that received the event var targetDoc = targetObj.ownerDocument; //Owner document var wg = document.getElementById("SVGroot"); var lg = document.getElementById("labelz"); //label labelBox= targetDoc.createElementNS("http://www.w3.org/2000/svg", "svg:rect"); labelBox.setAttributeNS(null, "id", "label1"); labelBox.setAttributeNS(null, "fill", "red"); labelBox.setAttributeNS(null, "fill-opacity", 1); labelBox.setAttributeNS(null, "x", 700); labelBox.setAttributeNS(null, "y", 400); labelBox.setAttributeNS(null, "width", 200); labelBox.setAttributeNS(null, "height", 20); labelBox.setAttributeNS(null, "visibility", "visible"); lg.appendC...

text 2 text