This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
PyXslt or XSLT transforming to PYX...
- To: xsl-list at mulberrytech dot com
- Subject: PyXslt or XSLT transforming to PYX...
- From: Eric van der Vlist <vdv at dyomedea dot com>
- Date: Thu, 23 Mar 2000 21:08:06 +0100
- CC: sean at digitome dot com
- Reply-To: xsl-list at mulberrytech dot com
Hi,
Pyxie is often opposed to XSLT, but they can also be complementary and
XSLT can generate PYX...
This simple XSLT transformation :
------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="text()"><xsl:if test="normalize-space()">
-<xsl:value-of select="normalize-space()"/></xsl:if></xsl:template>
<xsl:template match="*">
(<xsl:value-of select="name()"/><xsl:apply-templates
select="*|@*|text()"/>
)</xsl:template>
<xsl:template match="@*">
A<xsl:value-of select="concat(name(),' ',.)"/>
</xsl:template>
</xsl:stylesheet>
------------------------------
applied on Sean's XML example :
------------------------------
<Person>
<Surname>McGrath</Surname>
<Given>Sean</Given>
<e-mail type="internet">sean@digitome.com</e-mail>
</Person>
------------------------------
gives :
------------------------------
(Person
(Surname
-McGrath
)
(Given
-Sean
)
(e-mail
Atype internet
-sean@digitome.com
)
)
------------------------------
The white spaces and other special characters such as \n are not are not
preserved and neither the PI nor the namespaces are handled, but I think
it's already tasting like PYX...
Don't you think so ?
Eric
--
------------------------------------------------------------------------
Eric van der Vlist Dyomedea
http://xmlfr.org http://ducotede.com http://dyomedea.com
------------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list