Re: [xsl] OT: ICFP 2001 (xsl solution?)

Subject: Re: [xsl] OT: ICFP 2001 (xsl solution?)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 27 Jul 2001 18:11:44 +0100
> will 3 lines do:

having got that far i suppose I'd better finish.
a) I missed out a > so that would prepend all digits by x not just those
    in tags.
b) the rules it said to read from stdin and output to stdout


xx.sh
===========

sed  -e "1 s/^/<foo>/"  -e "$ s@\$@</foo>@" -e "s/\\([0-9]>\\)/x\\1/g" > tmp.xml
java com.icl.saxon.StyleSheet  tmp.xml  icfp.xsl


icfp.xsl
==========

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0"
                >

<xsl:output method="xml" omit-xml-declaration="yes" indent="no"/>

<xsl:template match="foo">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>


</xsl:stylesheet>


test file xx.x
===
1

<1>xxx</1>

<b>gg</b>

<9>xxx</9>
===



bash$ cat xx.x | ./xx.sh
===
1

<x1>xxx</x1>

<b>gg</b>

<x9>xxx</x9>
===bash$ 




I suspect that unquoted & are allowed (as no entities except lt and gt)
if so need another sed rule. but that's it from me:-)


David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread