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

XSLT stylistics query

  • To: xml-dev@l...
  • Subject: XSLT stylistics query
  • From: Simon Kissane <skissane@g...>
  • Date: Tue, 8 Feb 2005 17:45:52 +1100
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=eW+MaHOTm3hlE49UoY5Mk7lWoBpWOSem/88QCjez1pcPZS67jk6MhAJe9V1WdNusL0qwQk8vivBNqkOvsqzwZXKOsjpLC3AIPImR2ikiJqFgsBRoGpV4FMZybiX9qizy6uF/BqZVThR4lrx0syYPmFKfoEF6SC2hnam+cd+BiKs=
  • Reply-to: Simon Kissane <skissane@g...>

stylistics
Hi,

When I write XSL stylesheets, I often find myself writing code like
the following sample:

<xsl:template name="check-root-sections">
<xsl:for-each select="document($cfgschema)/ConfigSchema/RootSection">
<xsl:variable name="SectName" select="@Name" />
<xsl:variable name="SectType" select="@Type" />
<xsl:variable name="SectTypeDef"
select="document($cfgschema)/ConfigSchema/SectionType[@Name=$SectType]"
/>
<xsl:variable name="SectInstance"
select="document($srcdoc)/Config/Section[@Name=$SectName]" />
....

Notice that I declare these two variables, $SectName and $SectType. My
purpose in doing
so is because inside the [ ... ] operator, according to my
understanding, the context node changes to the node before the
operator. So, if I want to find something in my original context node,
before the [ ], I need to assign it to a variable first. (In fact, in
the above example, the two context nodes belong to entirely different
documents...)

Is there a cleaner way of doing this? Some XPath syntax to enable me
to say "the context node previous to the current top of stack..."? If
there was such a syntax, my code would be a lot cleaner, since I
wouldn't need so many variable declarations.

Cheers
Simon Kissane

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.