[Dev OpenGP] [50] XSLT in a better place

[ Thread Index | Date Index | More opengp.tuxfamily.org/development Archives ]


Revision: 50
Author:   alband85
Date:     2009-03-18 13:26:45 +0100 (Wed, 18 Mar 2009)

Log Message:
-----------
XSLT in a better place

Added Paths:
-----------
    trunk/src/tests/xslt/
    trunk/src/tests/xslt/keyvalue.out
    trunk/src/tests/xslt/keyvalue.xml
    trunk/src/tests/xslt/keyvalue.xsl


Added: trunk/src/tests/xslt/keyvalue.out
===================================================================
--- trunk/src/tests/xslt/keyvalue.out	                        (rev 0)
+++ trunk/src/tests/xslt/keyvalue.out	2009-03-18 12:26:45 UTC (rev 50)
@@ -0,0 +1,2 @@
+key1=1234
+key2="test string value"

Added: trunk/src/tests/xslt/keyvalue.xml
===================================================================
--- trunk/src/tests/xslt/keyvalue.xml	                        (rev 0)
+++ trunk/src/tests/xslt/keyvalue.xml	2009-03-18 12:26:45 UTC (rev 50)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<conf>
+				<key name="key1" type="int">1234</key>
+				<key name="key2" type="string">test string value</key>
+</conf>

Added: trunk/src/tests/xslt/keyvalue.xsl
===================================================================
--- trunk/src/tests/xslt/keyvalue.xsl	                        (rev 0)
+++ trunk/src/tests/xslt/keyvalue.xsl	2009-03-18 12:26:45 UTC (rev 50)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+				<xsl:output method="text" encoding="UTF-8" />
+
+				<xsl:template match="/">
+								<xsl:for-each select="conf/key">
+												<xsl:choose>
+																<xsl:when test="@type = 'string'">
+																				<xsl:value-of select="@name"/>=<xsl:text>&quot;</xsl:text><xsl:value-of select="."/><xsl:text>&quot;&#xa;</xsl:text>
+																</xsl:when>
+																<xsl:otherwise>
+																				<xsl:value-of select="@name"/>=<xsl:value-of select="."/><xsl:text>&#xa;</xsl:text>
+																</xsl:otherwise>
+												</xsl:choose>
+								</xsl:for-each>
+				</xsl:template>
+</xsl:stylesheet>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/