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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1146)
- Stylus Studio Technical Forum (14131)
-> + SS crashes when trying to save... (3)
-> + XML Pipelines (4)
-> + Handle Music Playlists in Styl... (2)
-> + Using a font in FOP (9)
-> + Automation in .NET/WebService ... (3)
-> + Convert .CSV file to XML (6)
-> + FOP Plugin does not install wi... (8)
-> + startup fault (2)
-> + xsd sequence question (5)
-> + Licence authentication failed ... (3)
-> + .NET API for the X12 To XML Ad... (6)
-> + data in tabular format (2)
-> + How to convert the xml String ... (4)
-> + SS Schema Validation misses an... (2)
-> + Problem in converting EDI file... (2)
-> + Generating image from XML and ... (2)
-> + Auto Schema builder is not cre... (3)
-> + XML/SQL update more tables (2)
-> + Default toolbar blocked (3)
-> + Stylus vs Altova Mapforce - St... (4)
-> + Problem with namespace while v... (3)
-> + Web Service Call - "unqualifie... (3)
-> + XML to SQL Server 2005 (2)
-> + XHTML with multiple schemas (2)
-> + Compare Stylus Studio with OBO... (2)
-> + Deploying java app using deplo... (3)
-> + Validating XML through Schema (3)
-> + Connecting to Informix 7.31 (2)
-> + EDI/XML question (4)
-> + X12 to XML Adapter (2)
-> + XSD conversion (2)
-> + Schema DateTime exception (2)
-> + Plug In Failure to regsiter (2)
-> + Reading EDIFACT (3)
-> - XML Playlist (1)
-> + Edit Xml In Place with Xslt vi... (5)
-> + validation error (9)
-> + Install error (2)
-> + how to get the xpath of xml el... (2)
-> + Can Stylus Studio be installed... (2)
-> + Built in XSLT Processor Too Sl... (2)
-> + Documentation (5)
-> + WSDL files (3)
-> + Generic flat file -> xml conve... (4)
-> + Stylus Studio crash after edit... (3)
-> + Does any one have a example to... (2)
-> + ComplexType Inheritance (6)
-> + Problem with starting (2)
-> + Icons (2)
-> + Using Saxon with xslt 2.0 (4)
-> + Wrong graphics size in preview... (2)
-> + TRANG and disable-abstract-ele... (5)
-> + Urgent: License Authentication... (3)
-> + Converting XML to CSV (10)
-> + conditional page body with XSL... (2)
-> + converting DTD to XSD (2)
-> + Stylus Studio doesn't appear t... (2)
-> + Embed XML-to-XML Mapping UI in... (3)
-> + Convert to XML (2)
-> + Tutorial Instructions Do Not M... (2)
-> + How can the attached file be e... (2)
-> + How to Generate xml file from ... (2)
-> + Multi-threaded Flat to XML ada... (2)
-> + XML Transformation -- Help Nee... (2)
-> + Loop in XSL (2)
-> + No error message when there sh... (2)
-> + Problems activating key in Sty... (2)
-> + sax parser (2)
-> + Hyperlink in xsl (2)
-> + Connection Timeout (5)
-> + SAX Parser error bcos of speci... (4)
-> + Running Java Code created by S... (3)
-> + Convert To XML - Sub Regions (2)
-> + create j2ee deploymeny descrip... (3)
-> + encoding (2)
-> + "SDQ format" processing (6)
-> + Base type could not be found (3)
-> + Changing default directory for... (3)
-> + XSLT Debug Call Stack doesn't ... (13)
-> + Basing XSLT on Schema (2)
-> + Xpath and the not operator (7)
-> + WSDL does not load properly (2)
-> + Stylus Studio won't run (7)
-> + XSLT Group By (2)
-> + Access problems to Tamino XML ... (2)
-> + Utilizing Stylus Studio for au... (4)
-> + Running Java file created from... (4)
-> + Showing All Validation Errors ... (6)
-> + How to read the value of defau... (2)
-> + Set the xmlns namespace depend... (11)
-> + CVS integration (2)
-> + buiding your own nodesets (11)
-> + XSD Validation (3)
-> + Moving Stylus Studio (2)
-> + StylusFileFactory.unlockAPI() ... (5)
-> + StylusFileFactory.unlockAPI FA... (2)
-> + Has the beta been released yet... (2)
-> + Custom File System java.lang.N... (4)
-> + Complex Flat File to XML Conve... (10)
-> + convert positional flat file t... (9)
-- Previous [1801-1820] [1821-1840] [1841-1860] Next
+ Website Feedback (244)
+ XSLT Help and Discussion (7507)
+ XQuery Help and Discussion (1890)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (361)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Peter CiuffettiSubject: Changing values of xsl:variables
Author: Peter Ciuffetti
Date: 25 May 2000 01:22 PM
Hello,

From my reading of the XSLT spec, xsl:variables are essentially constants.

Yet I didn't learn this until after I had gotten into the habit with Stylus of writing stylesheets that freely changed variables. Though I find it very helpful to be able to do so, I'm finding that my stylesheets don't work in other XSL processors if I take advantage of this capability in Stylus. Is this a 'feature' of Stylus or a 'bug'? Is it likely to disappear? Here's an example of Stylus letting me change a variable and the same stylesheet under Xalan:

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

Input test document:

<?xml version="1.0"?>
<test>
<child>a</child>
<child>b</child>
<child>c</child>
<child>d</child>
</test>

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

Stylesheet:

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

<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="test">
<xsl:variable name="ctr" select="0"/>
<test>
<xsl:for-each select="child">
<xsl:variable name="ctr" select="$ctr + 1"/>
<child><xsl:value-of select="$ctr"/></child>
</xsl:for-each>
</test>
</xsl:template>

<xsl:template match="child"/>

</xsl:stylesheet>
--------------------------------------------

Output produced with Stylus:

<test>
<child>1</child>
<child>2</child>
<child>3</child>
<child>4</child>
</test>

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

Output produced with Xalan:

<test>
<child>1</child>
<child>1</child>
<child>1</child>
<child>1</child>
</test>

Postnext
(Deleted User) Subject: Changing values of xsl:variables
Author: (Deleted User)
Date: 25 May 2000 03:06 PM
The spec reads, "It is an error if a binding established by an xsl:variable or xsl:param element within a template shadows another binding established by an xsl:variable or xsl:param element also within the template." It would seem both Stylus and Xalan have a bug in not signalling the error. This will be fixed in a future release. Thanks for your report.

Alex Lloyd
eXcelon corp.

Postnext
Peter CiuffettiSubject: Changing values of xsl:variables
Author: Peter Ciuffetti
Date: 31 May 2000 07:22 AM
When I use an xsl:variable inside a template, is it going to get a new binding every time the template is invoked, or will the binding be permanent after the first time the template is called?

E.g.

<xsl:template match="*">
<xsl:variable name="theName" select="name()"/>
...
</xsl:template>

Posttop
(Deleted User) Subject: Changing values of xsl:variables
Author: (Deleted User)
Date: 31 May 2000 10:58 AM
The scope of a variable declared in a template is one template instantiation. Successive instantiations will receive new instances of the variable.

Alex Lloyd
eXcelon corp.

   
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-2011 All Rights Reserved.