|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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@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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








