XIP Datenbank Import Beispiel: Unterschied zwischen den Versionen

Aus SiteparkWiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „<syntaxhighlight lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <import id="databaseimport" name="Import from Database"> <logging> <appender name=…“)
 
Zeile 1: Zeile 1:
 +
===XML Konfiguration===
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
Zeile 33: Zeile 34:
 
     </source>
 
     </source>
 
</import>
 
</import>
 +
</syntaxhighlight>
 +
 +
===XSLT===
 +
<syntaxhighlight lang="xml">
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
 +
<xsl:stylesheet version="1.0"
 +
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 +
    xmlns:xip="http://ies.sitepark.com/xip"
 +
    extension-element-prefixes="xip">
 +
 +
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
 +
 +
    <xsl:template match="/">
 +
        <xip>
 +
        <xsl:for-each select="/rowset/row">
 +
            <article parent="database.import.root" anchor="database.import.{_login}" name="{_lastname}, {_firstname}" filename="{_login}" template="database.import.template">
 +
                <text name="sp_title"><xsl:value-of select="_lastname"/>, <xsl:value-of select="_firstname"/></text>
 +
            </article>
 +
        </xsl:for-each>
 +
        </xip>
 +
    </xsl:template>
 +
</xsl:stylesheet>
 
</syntaxhighlight>
 
</syntaxhighlight>

Version vom 21. Juni 2010, 13:37 Uhr

XML Konfiguration

<?xml version="1.0" encoding="UTF-8"?>
<import id="databaseimport" name="Import from Database">
    <logging>
        <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d %-5p %m%n"/>
            </layout>
            <param name="File" value="${sitepark.home}/database-import.log"/>
            <param name="MaxFileSize" value="10MB"/>
            <param name="MaxBackupIndex" value="10"/>
        </appender>
        <logger name="com.sitepark.ies" additivity="false">
            <appender-ref ref="FILE"/>
            <priority value="INFO"/>
        </logger>
    </logging>
   <ies-connection login="Wartung" password="secret" client="ies2work" module="LDAP Importer"/>
   <options>
      <createElements>true</createElements>
      <deleteWorkDir>true</deleteWorkDir>
      <createPools>true</createPools>
      <updatePools>true</updatePools>
      <updateElements>true</updateElements>
      <deletePools>true</deletePools>
      <deleteOnlyEmptyPools>true</deleteOnlyEmptyPools>
      <deleteElements>true</deleteElements>
      <xslt>database-import.xslt</xslt>
      <syncFile>${sitepark.home}/conf/database-import.sync</syncFile>
   </options>
    <source type="database" id="1">
        <sql>SELECT * FROM UserDefinition</sql>
    </source>
</import>

XSLT

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xip="http://ies.sitepark.com/xip"
    extension-element-prefixes="xip">

    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/">
        <xip>
        <xsl:for-each select="/rowset/row">
            <article parent="database.import.root" anchor="database.import.{_login}" name="{_lastname}, {_firstname}" filename="{_login}" template="database.import.template">
                <text name="sp_title"><xsl:value-of select="_lastname"/>, <xsl:value-of select="_firstname"/></text>
            </article>
        </xsl:for-each>
        </xip>
    </xsl:template>
</xsl:stylesheet>