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

XSLT/XQuery polyglot

  • From: "Hermann Stamm-Wilbrandt" <STAMMW@de.ibm.com>
  • To: xml-dev@lists.xml.org
  • Date: Wed, 16 Dec 2015 04:20:34 +0100

XSLT/XQuery polyglot

Hi,

I did some searches but found no other mentioning of this.

From
https://en.wikipedia.org/wiki/Polyglot_(computing)
... a polyglot is a computer program or script written in a valid form of
multiple programming languages, which performs the same operations or output
independent of the programming language used to compile or interpret it. ...


Simple "poly.xml" is a XSLT/XQuery polyglot (same output):
$ java net.sf.saxon.Query -q:poly.xml > xq
$ java net.sf.saxon.Transform -xsl:poly.xml -s:poly.xml > xsl
$ diff xq xsl
$ cat xq ; echo
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"><xsl:template match="/"><xsl:copy-of select="document('')"/></xsl:template></xsl:stylesheet>
$
$ cat poly.xml
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"><xsl:template match="/"><xsl:copy-of select="document('')"/></xsl:template></xsl:stylesheet>
$


I found no option to avoid output of xml declaration in Saxon XQuery as
command line option.

declare option saxon:output "omit-xml-declaration=yes";
would need to stay before output and break XSLT that way.

At least the XSLT part would be a cheating quine at most only:
https://en.wikipedia.org/wiki/Quine_(computing)#.22Cheating.22_quines


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Compiler Level 3 support & Fixpack team lead
IBM DataPower Gateways     (⬚ᵈᵃᵗᵃ / ⣏⠆⡮⡆⢹⠁⡮⡆⡯⠂⢎⠆⡧⡇⣟⡃⡿⡃)
https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/    
https://twitter.com/HermannSW/     https://stamm-wilbrandt.de/GraphvizFiddle/
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.