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 April 6th, 2009, 11:30 PM
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT decision Making

Hi All
I am working on XSLT
I have a XML as follows
?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>
Update
</title>
<link>
myurl
</link>
<description>
</description>
<language>
en-us
</language>
<item>
<title>
title of item1
</title>
<link>
link of item1
</link>
<description>
description of item 1
</description>
</item>
<item>
......
..........
.......
</item>
now I am wiriting xsl
I have to write seperate mode for the value in title tag (Update) and if it is delete , another mode.
Can some one help me how to make decision ,
something like
<xsl:apply-templates select="/rss/channel/item" mode = "update"/>
and
<xsl:template match="/rss/channel/item" mode="save" >
here can I have to write some thing like , I need help in writing following decision making condition
<xsl: if test = "rss/channel/title = "update">
processing here
Also I have to write something like
<xsl:template match="/rss/channel/item" mode="delete" >
<xsl: if test = "rss/channel/title = "delete">
processing here
Thanks
Javaguy
 
Old April 7th, 2009, 06:28 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I am not sure I understand what you want to achieve but assuming you have different title element values based on which you want to process in different modes then do e.g.
Code:
...
<xsl:apply-templates select="/rss/channel[normalize-space(title) = 'Update']/item" mode="update"/>
<xsl:apply-templates select="/rss/channel[normalize-space(title) = 'Delete']/item" mode="delete"/>

...
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
General XSLT Questions in the XSLT Forum jminatel BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 0 March 31st, 2008 07:50 PM
Can XSLT read DTD/schema and Generate XSLT.. ROCXY XSLT 1 November 6th, 2006 09:39 AM
dynamic xslt -> xslt creation namespace problem jkmyoung XSLT 2 July 15th, 2006 12:42 AM
Implementation Decision reckon ASP.NET 1.x and 2.0 Application Design 2 June 28th, 2004 11:04 AM
Design decision on class library projects? tkubaska BOOK: ASP.NET Website Programming Problem-Design-Solution 2 May 19th, 2004 11:43 AM





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