Obfuscating XSLT

| 3 Comments | No TrackBacks

Inspired by ioccc.org, just for fun, really. Can you figure out what this stylesheet outputs (without running it of course)?

<!ENTITY _0_ 'string'>  
<!ENTITY _0-0_ 'sub&_0_;'>
<p x:version="1.0" xmlns:x="http://www.w3.org/1999/XSL/Transform">
  <x:variable name="_" select="document('')"/>
  <x:variable name="_-_" select="number(not(_-_=_-_=_-_=_-_))"/>
  <x:value-of select="concat(
    &_0-0_;(namespace-uri($_/*/*[$_-_]), $_-_, $_-_), 
    &_0-0_;(name($_/*/*[$_-_]), &_0_;-length(*>*)*2, $_-_),
    &_0-0_;(@_>_-, &_0_;-length(******* div @_), $_-_),
    translate(name(($_//@*)[5]), translate(name(($_//@*)[5]), 'l', ''), ''),
    &_0-0_;($_//namespace::*, &_0_;-length($_-_ div 0)+7, $_-_), '&#032;',
    &_0-0_;-after(&_0-0_;-before($_//namespace::*, 3), '.'),
    &_0-0_;($_//namespace::*, 15, 2),
    &_0-0_;(_/_/_=//_//_, 3, $_-_),
    &_0-0_;($_/*/*/@*[contains(.,'(')], $_-_, $_-_), '&#x21;')"/>

By the way, does anybody think XSLT obfuscator is a useful tool?

Related Blog Posts

No TrackBacks

TrackBack URL: http://www.tkachenko.com/cgi-bin/mt-tb.cgi/734


Depends on the input document. For example, and will produce different outputs. Also the order of namespace nodes 'x' and 'xml' is implementation-dependent.

hehe, I knew somebody will bring it on!

The obvious joke here is: Isn't XSLT obfuscated in the first place?

Leave a comment