Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2007, 10:31 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default contains function in XSLT 1.0

Hallo again,

I am sorry that I am asking many questions nowadays.

My problem is:

I have defined a parameter (with-param) like

<xsl:with-param name="containername" select="contains('#1#2#3#', concat('#', bar, '#'))"/>

so I checked this parameter in a template and for example 2 is missing in XML file. How can I write it down that 2 is missing? I cannot call it via $containername it gives me the result if it is true or false. Any help would be appreciated.

Your attitude determines your altitude
__________________
Your attitude determines your altitude
 
Old February 6th, 2007, 11:28 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I don't understand the question.

You seem to have worked out that "containername", despite its name, is not a string but a boolean (true or false). So it's not what you want, but you haven't explained clearly what you do want.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 6th, 2007, 12:14 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What I want is somethinh like this.

for example I checked it with xsl:if or xsl:when and the value 2 is missing. How can I show that 2 is missing in this sort of array (I named this #1#2#3# as array) I hope I could make me understand.

Your attitude determines your altitude
 
Old February 7th, 2007, 05:34 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am having anoher question. For instance I have this #2#4#5# string and I want to make it written in XSLT 1.0 like 2,4, or 5. Which functions should I use for it?

Your attitude determines your altitude
 
Old February 7th, 2007, 06:01 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

String manipulation is much easier in XSLT 2.0.

In 1.0 you just have to work with substring-before, substring-after, and so on. There are some templates and functions available in EXSLT (www.exslt.org) that can make your life a bit easier.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use replace function() xslt 2.0 dev.user06 XSLT 11 June 21st, 2012 04:00 AM
XSLT TRIM Function sagrock XSLT 1 November 23rd, 2007 08:39 AM
XSLT Function very urgent alapati.sasi XSLT 3 May 23rd, 2007 03:45 AM
javascript function in xslt swapnilp1983 XSLT 16 November 7th, 2006 12:39 AM
XSLT - Function to test value haixia XSLT 5 August 14th, 2006 09:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.