Mega Code Archive

 
Categories / XML Tutorial / XSLT StyleSheet
 

Get value from an element with value-of and select

File: Data.xml  <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="Transform.xslt"?> <greeting>Hello, world!</greeting> File: Transform.xslt <?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="/">     <html>       <head>         <title>Today's greeting</title>       </head>       <body>         <paragraph>           <xsl:value-of select="greeting" />         </p>       </body>     </html>   </xsl:template> </xsl:stylesheet> Output: <html>    <head>       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">       <title>Today's greeting</title>    </head>    <body>       <paragraph>Hello, world!</p>    </body> </html>