Subject: Re: [xsl] Transforming XML copied via XSLT From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx> Date: Wed, 27 Jan 2010 23:31:57 +0100 |
---food.xml----- (Input) <?xml version="1.0"?> <food> <sandwich> <name>tuna</name> <link>mysite.com</link> <price>$5.00</price> </sandwich> </food> ---/food.xml-----
---test2.xsl---- <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:saxon="http://saxon.sf.net/" version="2.0" exclude-result-prefixes="html saxon">
<xsl:template name="html"> <html> <head> <title>Menu</title> </head> <body> <h1>Menu</h1> <h2>Sandwiches</h2> <ul> <xsl:for-each select="document('food.xml')//sandwich"> <li> <xsl:apply-templates select="."/> </li> </xsl:for-each> </ul> </body> </html> </xsl:template>
<xsl:template match="sandwich"> <p> <a href="http://{link}"> <xsl:value-of select="name"/> </a> </p> <p> <xsl:value-of select="price"/> </p> </xsl:template>
</xsl:stylesheet> ---/test2.xsl------
No, perhaps this will better explain:
The input xml file might be: <sandwich> <name>tuna</name> <link>mysite.com</link> <price>$5.00</price> </sandwich>
I'm able to 'xsl:copy-of' into my file but I'm not sure the best way to obtain these results: <a href="http://mysite.com/">tuna</a> <p>$5.00</p>
-- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de
Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930
GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt, Dr. Reinhard VC6ckler
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Transforming XML copied v, Rob Belics | Thread | Re: [xsl] Transforming XML copied v, Rob Belics |
Re: [xsl] Transforming XML copied v, Rob Belics | Date | Re: [xsl] Transforming XML copied v, Rob Belics |
Month |