Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 17th, 2005, 07:19 PM
C4 C4 is offline
Registered User
 
Join Date: Nov 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT Newbie needs help... Should be easy fix!

I'm a newbie to XML/XSLT, and I'm sure this is very easy to do for someone who has experience in it... I'm trying to make an XSLT file that displays ONLY <CurrentValue> and <DbValue> of those items who's <IsChanged> value = "True". Can someone please fix this XSLT source for me???

----------- XSLT START -----------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<tr>
<th>Old Value</th>
<th>New Value</th>
</tr>
<xsl:apply-templates select="//Fields" />
</table>
</xsl:template>
<xsl:template match="Fields">
<tr>
<td>
<xsl:value-of select="<DbValue Goes Here>"/>
</td>
<td>
<xsl:value-of select="<CurrentValue Goes Here>"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
----------- XSLT STOP -----------

Here is my sample XML file...

----------- XML START -----------
<Fields>
<PhoneNumber>
<CurrentValue Type="System.String">888-555-1212</CurrentValue>
<DbValue Type="System.String">800-555-1212</DbValue>
<IsChanged Type="System.Boolean">True</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</PhoneNumber>
<PhoneType>
<CurrentValue Type="AMENTOR4UDB.PhoneTypes">Home</CurrentValue>
<DbValue Type="AMENTOR4UDB.PhoneTypes">Home</DbValue>
<IsChanged Type="System.Boolean">False</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</PhoneType>
<ContactId>
<CurrentValue Type="System.Int64">100</CurrentValue>
<DbValue Type="System.Int64">100</DbValue>
<IsChanged Type="System.Boolean">False</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</ContactId>
<EmailAddress>
<CurrentValue Type="System.String">company@email.com</CurrentValue>
<DbValue Type="System.String">my@email.com</DbValue>
<IsChanged Type="System.Boolean">True</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</EmailAddress>
<EmailType>
<CurrentValue Type="AMENTOR4UDB.EmailTypes">Primary</CurrentValue>
<DbValue Type="AMENTOR4UDB.EmailTypes">Primary</DbValue>
<IsChanged Type="System.Boolean">False</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</EmailType>
<ContactId>
<CurrentValue Type="System.Int64">100</CurrentValue>
<DbValue Type="System.Int64">100</DbValue>
<IsChanged Type="System.Boolean">False</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</ContactId>
<EmailVerified>
<CurrentValue Type="System.Boolean">True</CurrentValue>
<DbValue Type="System.Boolean">True</DbValue>
<IsChanged Type="System.Boolean">False</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</EmailVerified>
<EmailValidationKey>
<CurrentValue Type="System.Guid">00000000-0000-0000-0000-000000000000</CurrentValue>
<DbValue Type="System.Guid">00000000-0000-0000-0000-000000000000</DbValue>
<IsChanged Type="System.Boolean">False</IsChanged>
<IsNull Type="System.Boolean">False</IsNull>
</EmailValidationKey>
</Fields>
----------- XML STOP -----------



Reply With Quote
  #2 (permalink)  
Old November 21st, 2005, 04:11 AM
Authorized User
 
Join Date: Oct 2005
Location: , , Philippines.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<td>
 <xsl:if test="following-sibling::IsChange[1]='True'">
  <xsl:value-of select="CurrentValue">
</td>
this goes the same for DbValue...

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie XSLT question fedehf XSLT 4 January 29th, 2008 03:09 PM
Newbie XSLT question wasabi XSLT 2 March 8th, 2007 01:06 PM
XML structure for easy XSLT coldstar XSLT 2 September 10th, 2006 04:09 PM
Newbie -- very easy question bekim Javascript 3 May 11th, 2005 11:12 PM
easy XSLT question sgruhier XSLT 3 February 18th, 2005 11:43 AM



All times are GMT -4. The time now is 06:16 AM.


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