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

Re: would like to simplify my XSLT

Subject: Re: would like to simplify my XSLT
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 29 Jan 2007 15:34:40 +0100
Re:  would like to simplify my XSLT
Abel Braaksma wrote:

You are using translate(), which hints (imo) that you are using XSLT 1. Can you confirm? Or do you use XSLT 2 (this highly influences the answers you will get)?

Here's one solution. I believe it will work on both 1.0 and 2.0, but I tested only 2.0.


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

   <xsl:template match="
                 person[document[
                 not(@relid =
                 ../../../documents/document/@id)]]">

       <person name="{name}" />
   </xsl:template>

It will output all persons that have at least one not-matching @relid, like this, for your input:

<person name="Chris" />

Your own code much resembles the way you may do it in imperative languages like Java, PHP, VB or C. However, using templates, you can let the processor do the math for you and you only have to draw the rules.

Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

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.