Subject: PyXslt or XSLT transforming to PYX... From: Eric van der Vlist <vdv@xxxxxxxxxxxx> Date: Thu, 23 Mar 2000 21:08:06 +0100 |
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@xxxxxxxxxxxx</e-mail> </Person> ------------------------------ gives : ------------------------------ (Person (Surname -McGrath ) (Given -Sean ) (e-mail Atype internet -sean@xxxxxxxxxxxx ) ) ------------------------------ 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Eu tambem estou tentando fazer a me, Jonathan Asbell | Thread | XML reporting tool ?, Pady Srinivasan |
Re: recursion and looping, Phil Lanch | Date | Re: recursion and looping, Francois Lachance |
Month |