Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| 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 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 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 -----------



 
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...





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





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