This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PyXslt or XSLT transforming to PYX...


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]