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

Re: Single transformation using XSLT on-the-fly

Subject: Re: Single transformation using XSLT on-the-fly
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: Sat, 18 Oct 2008 20:39:50 +0100
Re:  Single transformation using XSLT on-the-fly
>>>>> "Giacomo" == Giacomo  <giacgbj@xxxxxxx> writes:

    >> Well, it rather depends upon your definition of a single
    >> transformation, and how much you are prepared to cheat.

    Giacomo> When I said "a single transformation" I meant applying
    Giacomo> the stylesheet only once. If the stylesheet is able to do
    Giacomo> other transformations it's right for me.


    >> But using an extension function means you aren't doing it in
    >> pure XSLT 2.0. Well, you didn't say pure.
    >> 
    >> Do you want an example?

    Giacomo> Of course, I'm not pure ;)

Well, here is the example I just wrote.

Testing it found a bug (so you can't run it), but I fixed the bug,
locally. The output was:

<?xml etc. ?>
Tested OK.

Change the xsl:value-of to xsl:sequence prints the XML, instead of the
contents.

This is the transformation:

<?xml version="1.0" encoding="utf-8"?>
<xsl:transform 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:gexslt="http://www.gobosoft.com/eiffel/gobo/gexslt/extension"
   xmlns:axsl="file://namespace.alias"
    version="2.0">

  <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
  
  <xsl:template name="initial">
    <xsl:call-template name="build"/>
    <xsl:call-template name="run"/>
  </xsl:template>
  
  <xsl:template name="build">
    <xsl:result-document href="file:///home/colin/gestalt/generated.xslt">
      <axsl:transform version="2.0">
	<axsl:template match="/">
	  <doc>
	    Tested OK.
	  </doc>
	</axsl:template>
      </axsl:transform>
    </xsl:result-document>
  </xsl:template>
  
  <xsl:template name="run">
    <xsl:variable name="generated" select="gexslt:transformation('file:///home/colin/gestalt/alias.xsl',doc('file:///home/colin/gestalt/system.xace'))"/>
    <xsl:value-of select="$generated"/>
  </xsl:template>

</xsl:transform>

This worked (after fixing the bug, which means you can't run it at
home), by first creating a symbolic link from

alias.xsl onto generated.xslt.

A real cheat.
-- 
Colin Adams
Preston Lancashire

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.