XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS