cpdev 0 Report post Posted January 26, 2015 Hello Guys, I'm relatively new to XSLT and obviously I miss the wood for trees.... here is the XML I want to send to the Transformator (php simple_xml): <?xml version='1.0' standalone='yes'?> <master> <customer> <name>TEstkunde</name> <short>TK</short> <ref>0001</ref> </customer> <customer> <name>TEstkunde2</name> <short>TK2</short> <ref>0002</ref> </customer> </master> and here the XSL Stylesheet I copied and manipulated from W3 schools "XSL:For-each": <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <table> <tr> <th>Kurzname</th> <th>Kundenname</th> <th>Kundenreferenznummer</th> <th>aktive Projekte</th> </tr> <xsl:for-each select="customer"> <tr> <td><xsl:value-of select="name" /></td> <td><xsl:value-of select="short" /></td> <td><xsl:value-of select="ref" /></td> <td><xsl:value-of select="proj" /></td> </tr> </xsl:for-each> <tr> <td><input type="text" caption="Kundenname" id="customer"/></td> <td><input type="text" caption="Kurzname" id="cust_short"/></td> <td><input type="text" caption="Kundenerferenznummer" id="cust_id" /></td> <td><input type="submit" value="+" /></td> </tr></table></xsl:template></xsl:stylesheet> For whatever reason, only the last row and the header is shown, but the data from the XML is omitted. Can you please point me in the right direction and possibly explain where I'm wrong? Thanks a lot. BR, Sebastian Quote Share this post Link to post Share on other sites
Ingolme 971 Report post Posted January 26, 2015 Going by this W3Schools example I think maybe including the root node in the selector might work: <xsl:for-each select="master/customer"> It's been years since I last used XSLT, so I'm not sure. And it might be that the PHP library works a little bit different than browsers do. Unfortunately, our resident XML expert hasn't been on the forums for a couple of years. Quote Share this post Link to post Share on other sites
cpdev 0 Report post Posted January 27, 2015 Hi Ingolme, Thanks for your great answer. its solved. Br, Sebastian Quote Share this post Link to post Share on other sites