[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: RE: extract values from an attribute, then math d

Subject: RE: RE: extract values from an attribute, then math division
From: cknell@xxxxxxxxxx
Date: Fri, 21 Jul 2006 09:02:40 -0400
xslt extract attribute
It's just a matter of substring-ing through the attribute value.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes" />
  <xsl:strip-space elements="*" />

  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>
	
  <xsl:template match="Item">
    <xsl:apply-templates />
  </xsl:template>
  
  <xsl:template match="Value">
    <xsl:variable name="total" select="substring-after(substring-before(@result,' [Count]'),'[Total] = ')" />
    <xsl:variable name="count" select="substring-after(@result,'[Count] = ')" />
    <xsl:value-of select="($total div $count) div 100" />
  </xsl:template>

</xsl:stylesheet>
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Leslie Young <xlr8sx@xxxxxxxxxxx>
Sent:     Fri, 21 Jul 2006 07:03:05 -0500
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  RE:  extract values from an attribute, then math division

I am using XSLT 1.0.
Thanks!

>From: cknell@xxxxxxxxxx
>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: RE:  extract values from an attribute, then math division
>Date: Fri, 21 Jul 2006 07:04:27 -0400
>
>Are you using XSLT 1.0 or XSLT 2.0?
>
>If the latter, have a look at the thread I started yesterday at 
>http://www.biglist.com/lists/xsl-list/archives/200607/msg00582.html
>--
>Charles Knell
>cknell@xxxxxxxxxx - email
>
>
>
>-----Original Message-----
>From:     Leslie Young <xlr8sx@xxxxxxxxxxx>
>Sent:     Thu, 20 Jul 2006 19:57:00 -0500
>To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject:   extract values from an attribute, then math division
>
>I need to extract 2 values from an attribute and perform math division. For
>example, define a variable = [Total] / [Count] / 100 from the following
>Value element.  Any advise how to do it?
>
><Item name="AAA">
>    <Value name="Samples" result="Samples: [Total] = 2000.0 [Count] = 50" 
>/>
></Item>
>
>Thanks in advance!
>
>_________________________________________________________________
>Don?t just search. Find. Check out the new MSN Search!
>http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.