User Tools

Site Tools


misc:xml

Misc

CDATA section

Starts with “<![CDATA[” and ends with “]]>”

<script type="text/javascript">
  // <![CDATA[
  $(function () {
    if ($.browser.msie && parseInt($.browser.version, 10) <= 7) {
      // ...
    }
  });
  // ]]>
</script>

XSL

Kopieren

 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0" xmlns:xalan="http://xml.apache.org/xslt">

	<xsl:output method="xml"></xsl:output>

	<xsl:template match="/">
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="//category[[@visible = 'false']"></xsl:template>

	<xsl:template match="//role"></xsl:template>

	<xsl:template match="@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="@*|node()" />
		</xsl:copy>
	</xsl:template>

 </xsl:stylesheet>

SQL bzw. Text erzeugen

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0"
    xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="text"/>

<xsl:template match="/">
	<xsl:apply-templates select="//config-param"/>
</xsl:template>

<xsl:template match="//config-param">
	<xsl:text>insert into config values("app.</xsl:text>
	<xsl:value-of select="param-name"/>
	<xsl:text>", "</xsl:text>
	<xsl:value-of select="param-value"/>
	<xsl:text>");&#10;</xsl:text>
</xsl:template>

</xsl:stylesheet>

xhtml

xhtml example

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head>
<title>The title</title>
</head>
<body>
<h1>Example xhtml Page</h1>
<p>A paragraph</p>
</body>
</html>

misc/xml.txt · Last modified: 2011/11/18 18:14 by hgoebl