Article View: pl.comp.xml
Article #9619Re: Problem z obliczeniami
From: moozzyk
Date: Fri, 28 Dec 2007 07:52
Date: Fri, 28 Dec 2007 07:52
81 lines
4020 bytes
4020 bytes
"ChrisB" <abuse@tpi.pl> wrote in message news:fl0ce1$c7m$1@atlantis.news.tpi.pl... > Witam! > > Na zaliczenie mam projekt z XML i XSL, temat: "Faktura". > Fragment XML opisujacy pozycje na fakturze: > > <Pozycja> > <LP>1</LP> > <Indeks>Indeks 1</Indeks> > <Opis>Opis 1</Opis> > <Ilosc>3</Ilosc> > <Jednostka>m2</Jednostka> > <CenaPLN>25</CenaPLN> > <StawkaVAT> > <Procent>22</Procent> > </StawkaVAT> > </Pozycja> > > <Pozycja> > <LP>2</LP> > <Indeks>Indeks 2</Indeks> > <Opis>Opis 2</Opis> > <Ilosc>2</Ilosc> > <Jednostka>m2</Jednostka> > <CenaPLN>2</CenaPLN> > <StawkaVAT> > <Procent>22</Procent> > </StawkaVAT> > </Pozycja> > > <Pozycja> > <LP>3</LP> > <Indeks>Indeks 3</Indeks> > <Opis>Opis 3</Opis> > <Ilosc>5</Ilosc> > <Jednostka>m2</Jednostka> > <CenaPLN>5</CenaPLN> > <StawkaVAT> > <Procent>22</Procent> > </StawkaVAT> > </Pozycja> > > W XSL obliczam cene brutto dla kazdej pozycji w ten oto sposob (w > skrocie): > <xsl:template match="Pozycja"> > <xsl:variable name="ilosc_sztuk" select="Ilosc" /> > <xsl:variable name="cena" select="CenaPLN" /> > <xsl:variable name="wart_netto" select="$ilosc_sztuk * $cena" /> > <xsl:variable name="vat" select="StawkaVAT/Procent" /> > <xsl:variable name="cena_vat" select="$wart_netto * $vat div 100" /> > <xsl:variable name="cena_z_vat" select="$cena_vat + $wart_netto" /> > <xsl:value-of select="$cena_z_vat"/> > </xsl:template> > > I teraz musze zrobic podsumowanie faktury czyli obliczyc kwote do zaplaty > czyli dla kazdego z towarow wykonac to co jest powyzej i zsumowac to > wszystko... ale jak? > > Uzycie: > > sum((/Faktura/Pozycja/Ilosc * /Faktura/Pozycja/CenaPLN) * > /Faktura/Pozycja/StawkaVAT/Procent)) > > powoduje blad: Wyrażenie nie zwraca węzła DOM. > Sumwowanie w stylu Suma = Suma + Pozycja rowniez odpada bo zmienna w XSL > nie moga zmieniac swoich wartosci. > > Macie jakies pomysly jak to zrobic? > > -- > Chrisb Hint: Uzyj zmiennej bedacej RTF (result tree fragment) i zawierajacej iloczyny czastkowe a potem to zsumuj. moozzyk --------------------------------- http://xml.com.pl http://xml.com.pl/XmlFellow.aspx
Technical Details
Message-ID:
<NumdncfT_I-0NunanZ2dnUVZ_uGknZ2d@comcast.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!feed.news.interia.pl!news.nask.pl!news.nask.org.pl!news.uni-stuttgart.de!news.belwue.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.freenet.de!newspeer1.nwr.nac.net!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mailReferences:
<fl0ce1$c7m$1@atlantis.news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!feed.news.interia.pl!news.nask.pl!news.nask.org.pl!news.uni-stuttgart.de!news.belwue.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.freenet.de!newspeer1.nwr.nac.net!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 28 Dec 2007 01:52:09 -0600 From: "moozzyk" <moozzyk@[_NO_SPAM_]xml.com.pl> Newsgroups: pl.comp.xml References: <fl0ce1$c7m$1@atlantis.news.tpi.pl> Subject: Re: Problem z obliczeniami Date: Thu, 27 Dec 2007 23:52:03 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response Message-ID: <NumdncfT_I-0NunanZ2dnUVZ_uGknZ2d@comcast.com> Lines: 83 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 71.227.177.200 X-Trace: sv3-eWWCDqDNK8tHFbWESAibXjzrjFO07z8+8QmGkLgxNAEk2ksJY1WP6Jmof57AyIla8rI9BMP2rQjCe9q!Xq0cgtm8/OiIXItfvYlTXn/dxmh0G71WpwN0ZfbFAE1kPED49WTV0s0HBu4D/g0P8digXSzsWdvo!SF8aSHxZr+Gjs0Dp/nWvAz3JJw5KWOk= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.37 X-Original-Bytes: 3651 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit