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 November 11th, 2008, 10:38 PM
Registered User
 
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem in navigating

Hi,
I have a XML doc
<A>
<A1>
<a2> 4 </a2>
    <a3> 6 </a3>
    <a4> 7 </a4>
</A1>
<A2>
    <a5> 2 </a5>
    <a6> 1 </a6>
    <a7> 7 </a7>
</A2>
<A3>
    <a8> 2 </a8>
    <a9> 1 </a9>
    <a10> 7 </a10>
</A3>
   <A4>
     ....</A4>
   ...
   <An>
   ....</An>
</A>

I have n number of nodes. Actually, I need to calculate determinant
of nxn matrix.
I need to do this calculation
(a6*a10+a7*a9)-(a7*a8+a5*a10)+(a5*a9+a8*a6)....


Please could anyone help me in writing this stylesheet? The main problem is how to navigate through this tree.
 
Old November 12th, 2008, 01:45 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Default

Try this:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:variable name="a1" select="//a6*//a10+//a7*//a9"></xsl:variable>
    <xsl:variable name="a2" select="//a7*//a8+//a5*//a10"></xsl:variable>
    <xsl:variable name="a3" select="//a5*//a9+//a8*//a6"></xsl:variable>

    <xsl:template match="A">
        <xsl:value-of select="$a1 - $a2 + $a3"></xsl:value-of>
    </xsl:template>

</xsl:stylesheet>

------
Rummy





Similar Threads
Thread Thread Starter Forum Replies Last Post
Navigating through the data in MySQL prad_a MySQL 4 March 23rd, 2007 01:58 AM
Navigating Recordsets w/out specifying name Tethys Access VBA 7 December 5th, 2005 04:47 PM
navigating a dataset ranakdinesh BOOK: Professional C#, 2nd and 3rd Editions 4 June 1st, 2004 11:37 PM
Navigating between Forms rakeshgnair Access VBA 1 May 21st, 2004 11:28 PM
Display Problem: Navigating LINK maahee ADO.NET 0 April 24th, 2004 10:44 AM





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