XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
giancarlo rossiSubject: Min template
Author: giancarlo rossi
Date: 25 Aug 2006 09:57 AM
Hi guys,

I found a template able to find a min value in a nodelist.
It has composed buy 2 file:


Min.xsl

-------------------------------------------
<xsl:template name="Min">

<xsl:param name="list" />
<xsl:param name="nMin" select="'0'"/>

<xsl:choose>
<xsl:when test="$list">

<xsl:variable name="remainingList" select="$list[position() != 1]" />
<xsl:variable name="nNewMin">
<xsl:choose>
<xsl:when test="$list[1] &lt; $nMin">
<xsl:value-of select="$list[1]" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nMin" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="Min">
<xsl:with-param name="list" select="$remainingList"/>
<xsl:with-param name="nMin" select="$nNewMin"/>
</xsl:call-template>

</xsl:when>

<xsl:otherwise>
<xsl:value-of select="$nMin" />

</xsl:otherwise>
</xsl:choose>
</xsl:template>

-------------------------------------------------

and ShowMin.xsl ( able to show the Min value)

<xsl:include href="Min.xsl"/>
<xsl:template match="/">
<xsl:variable name="nMinTemp">
<xsl:call-template name="Min">
<xsl:with-param name="list" select=".//GroupList/Group/OutwardList/Outward/Price/Amount"/>
<xsl:with-param name="nMin" select="'99999'"/>
</xsl:call-template>
</xsl:variable>
<h3>Il prezzo più basso è: <xsl:value-of select="$nMinTemp"/></h3>
<br/>
</xsl:template>

---------------------------------------------------

With style sudio It works well...
but recall it from an asp page the response is "99999"

The calling is a standard asp:

Set XmlDocument = CreateObject("Microsoft.XMLDOM")
XmlDocument.async = False
XmlDocument.load(Server.MapPath("last_mad_lgw.xml"))

set xsl_ok = Server.CreateObject("Microsoft.XMLDOM")
xsl_ok.async = false
xsl_ok.load(Server.MapPath("ShowMin.xsl"))


Response.Write( XmlDocument.transformNode(xsl_OK))

The xml you could find here:

www.lastminutesud.it/test/andata_fco.xml

Regards.







Postnext
James DurningSubject: Min template
Author: James Durning
Date: 25 Aug 2006 12:15 PM
2 things you could try,
1. remove the . from the first param
2. remove the quotes from the second param

<xsl:with-param name="list" select="//GroupList/Group/OutwardList/Outward/Price/Amount"/>
<xsl:with-param name="nMin" select="99999"/>

Postnext
giancarlo rossiSubject: Min template
Author: giancarlo rossi
Date: 25 Aug 2006 12:38 PM
Hi....

It' doesnt works in asp...
with or without quote...

the response.is still 99999
but in stylestudio it works well.

It is possible if a price/amount is empty it goes on a error ?

The code below work with sylestudio with "built in".



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:include href="Min.xsl"/>
<xsl:template match="/">
<xsl:variable name="nMinTemp">
<xsl:call-template name="Min">
<xsl:with-param name="list" select="//GroupList/Group/OutwardList/Outward/Price/Amount"/>
<xsl:with-param name="nMin" select="'99999'"/>
</xsl:call-template>
</xsl:variable>
<h3>Il prezzo più basso è: <xsl:value-of select="$nMinTemp"/></h3>
<br/>
</xsl:template>
</xsl:stylesheet>

Postnext
Ivan PedruzziSubject: Min template
Author: Ivan Pedruzzi
Date: 25 Aug 2006 03:35 PM

Giancarlo,

You can preview your XSLT using MSXML from inside Stylus Studio.
Just click "..." in the toolbar and then click on the "Processor" page.

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
giancarlo rossiSubject: Min template
Author: giancarlo rossi
Date: 25 Aug 2006 04:21 PM
Ciao Ivano,

I try also to test in stylestudio with processor MSXLM

it works, but not in the asp page :-)


Postnext
giancarlo rossiSubject: Min template
Author: giancarlo rossi
Date: 25 Aug 2006 04:25 PM
Sorry again...

I try using MSXML 6


Error occurred while compiling stylesheet 'c:\Inetpub\wwwroot\lastfinale4\TEST\STY75.xsl'.

Code: 0x80004005
Il modello definito "Min" non è presente nel foglio di stile.
...done
The model "Min" is not present in the stylesheet..

But I use the MSXML


Postnext
giancarlo rossiSubject: Min template
Author: giancarlo rossi
Date: 25 Aug 2006 04:29 PM
Sorry again...

I try using MSXML 6


Error occurred while compiling stylesheet 'c:\Inetpub\wwwroot\lastfinale4\TEST\STY75.xsl'.

Code: 0x80004005
Il modello definito "Min" non è presente nel foglio di stile.
...done
The model "Min" is not present in the stylesheet..

But I use the MSXML


Postnext
Ivan PedruzziSubject: Min template
Author: Ivan Pedruzzi
Date: 25 Aug 2006 04:52 PM

Your XSLT works fine with MSXML 4.0

Are you usre that the XML used in the script (last_mad_lgw.xml) has the same structure of andata_fco.xml?

Ivan

Postnext
giancarlo rossiSubject: Min template
Author: giancarlo rossi
Date: 25 Aug 2006 04:56 PM
I tryed with 2 different scenario...
With andata_fco.xml
and with last_mad_lgw.xml.

But I have installed the MSXML 6.0 not 4.0.


Postnext
Ivan PedruzziSubject: Min template
Author: Ivan Pedruzzi
Date: 25 Aug 2006 05:08 PM

May be you are hitting a security restriction enforced on MSXML 6.0
that blocks xsl:include|xsl:import
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/ba3e4d4f-1ee7-4226-a51a-78a1f1b5bd8a.asp

Change your script to the following

set xsl_ok = Server.CreateObject("Microsoft.XMLDOM")
xsl_ok.async = false
xsl_ok.resolveExternals = true;
xsl_ok.load(Server.MapPath("ShowMin.xsl"))

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Posttop
giancarlo rossiSubject: Min template
Author: giancarlo rossi
Date: 25 Aug 2006 05:13 PM
wow ... Ivan It works.

Thanks a lot.

Ciao.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.