XIP HTTP Import Beispiel: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Die Seite wurde neu angelegt: „<syntaxhighlight lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <import id="formsolutions" name="Formsolutions Import"> <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 16: | Zeile 17: | ||
</logger> | </logger> | ||
</logging> | </logging> | ||
− | <ies-connection login="Wartung" password=" | + | <ies-connection login="Wartung" password="secret" client="ies2work" module="Form Solutions Importer"/> |
<options> | <options> | ||
<createElements>true</createElements> | <createElements>true</createElements> | ||
Zeile 46: | Zeile 47: | ||
</source> | </source> | ||
</import> | </import> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===XSLT=== | ||
+ | <syntaxhighlight lang="xml"> | ||
+ | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
+ | <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:function name="xip:getCategoryId"> <xsl:param name="s"/> | ||
+ | <!-- Erstes Zeichen ermitteln --> | ||
+ | <xsl:variable name="id" select="substring-before($s,' ')"/> | ||
+ | <xsl:value-of select="substring-before($s,' ')"/> | ||
+ | </xsl:function> | ||
+ | |||
+ | <xsl:key name="categoryId" match="item" use="xip:getCategoryId(kat)"/> | ||
+ | |||
+ | <xsl:template match="/"> | ||
+ | <xip> | ||
+ | <resource parent="formsolutions" anchor="formsolutions.config" name="Form Solutions Konfiguration" template="formsolutions.template.config"> | ||
+ | <text name="wsurl">${wsurl}</text> | ||
+ | <text name="cms">${cmskey}</text> | ||
+ | <text name="user">${user}</text> | ||
+ | </resource> | ||
+ | <!-- Schleife über Kategorien --> | ||
+ | <xsl:for-each select="//item[generate-id() = generate-id(key('categoryId', xip:getCategoryId(kat))[1])]"> | ||
+ | |||
+ | <xsl:variable name="category" select="xip:getCategoryId(kat)"/> | ||
+ | <!-- gelöschte Formulare haben keine Kategorie --> | ||
+ | <xsl:if test="$category != ''"> | ||
+ | <xsl:variable name="categoryName" select="kat/text()"/> | ||
+ | <articlepool parent="formsolutions" anchor="formsolutions.category.{$category}" name="{$categoryName}"> | ||
+ | <resource> | ||
+ | <text name="container" anchor="is5:gui.container.infosite.standard"/> | ||
+ | <text name="registrationTemplate" anchor="is5:gui.container.infosite.standard.all"/> | ||
+ | <text name="editorTemplatePool" anchor="standard.container.editing"></text> | ||
+ | </resource> | ||
+ | <!-- Schleife über alle mit gleicher Kategorie --> | ||
+ | <xsl:for-each select="key('categoryId',$category)"> | ||
+ | <resource anchor="formsolutions.form.{fnr}" name="{title} ({fnr})" template="formsolutions.template.form"> | ||
+ | <comment><xsl:value-of select="bem"/></comment> | ||
+ | <text name="fs_fnr"><xsl:value-of select="fnr"/></text> | ||
+ | <text name="fs_pagecount"><xsl:value-of select="pagecount"/></text> | ||
+ | <text name="fs_created"><xsl:value-of select="created"/></text> | ||
+ | <text name="fs_changed"><xsl:value-of select="changed"/></text> | ||
+ | <text name="fs_beschr"><xsl:value-of select="beschr"/></text> | ||
+ | <text name="fs_type"><xsl:value-of select="type"/></text> | ||
+ | </resource> | ||
+ | </xsl:for-each> | ||
+ | </articlepool> | ||
+ | </xsl:if> | ||
+ | </xsl:for-each> | ||
+ | </xip> | ||
+ | </xsl:template> | ||
+ | |||
+ | </xsl:stylesheet> | ||
</syntaxhighlight> | </syntaxhighlight> |
Version vom 21. Juni 2010, 13:38 Uhr
XML Konfiguration
<?xml version="1.0" encoding="UTF-8"?>
<import id="formsolutions" name="Formsolutions Import">
<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}/form-solutions.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="Form Solutions 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>${sitepark.home}/conf/form-solutions.xslt</xslt>
<syncFile>${sitepark.home}/conf/form-solutions.sync</syncFile>
<attributes>
<attribute name="cmskey">xxx</attribute>
<attribute name="wsurl">https://webservice-url</attribute>
<attribute name="user">123</attribute>
</attributes>
</options>
<source type="http" url="${wsurl}/getformlist.php" method="post">
<header name="SOAPAction">"urn:FS#getformlist"</header>
<body content-type="text/xml; charset=UTF-8"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:FS" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<tns:getformlist xmlns:tns="urn:FS">
<cms xsi:type="xsd:string">${cmskey}</cms>
</tns:getformlist>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>]]></body>
</source>
</import>
XSLT
<?xml version="1.0" encoding="ISO-8859-1"?>
<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:function name="xip:getCategoryId"> <xsl:param name="s"/>
<!-- Erstes Zeichen ermitteln -->
<xsl:variable name="id" select="substring-before($s,' ')"/>
<xsl:value-of select="substring-before($s,' ')"/>
</xsl:function>
<xsl:key name="categoryId" match="item" use="xip:getCategoryId(kat)"/>
<xsl:template match="/">
<xip>
<resource parent="formsolutions" anchor="formsolutions.config" name="Form Solutions Konfiguration" template="formsolutions.template.config">
<text name="wsurl">${wsurl}</text>
<text name="cms">${cmskey}</text>
<text name="user">${user}</text>
</resource>
<!-- Schleife über Kategorien -->
<xsl:for-each select="//item[generate-id() = generate-id(key('categoryId', xip:getCategoryId(kat))[1])]">
<xsl:variable name="category" select="xip:getCategoryId(kat)"/>
<!-- gelöschte Formulare haben keine Kategorie -->
<xsl:if test="$category != ''">
<xsl:variable name="categoryName" select="kat/text()"/>
<articlepool parent="formsolutions" anchor="formsolutions.category.{$category}" name="{$categoryName}">
<resource>
<text name="container" anchor="is5:gui.container.infosite.standard"/>
<text name="registrationTemplate" anchor="is5:gui.container.infosite.standard.all"/>
<text name="editorTemplatePool" anchor="standard.container.editing"></text>
</resource>
<!-- Schleife über alle mit gleicher Kategorie -->
<xsl:for-each select="key('categoryId',$category)">
<resource anchor="formsolutions.form.{fnr}" name="{title} ({fnr})" template="formsolutions.template.form">
<comment><xsl:value-of select="bem"/></comment>
<text name="fs_fnr"><xsl:value-of select="fnr"/></text>
<text name="fs_pagecount"><xsl:value-of select="pagecount"/></text>
<text name="fs_created"><xsl:value-of select="created"/></text>
<text name="fs_changed"><xsl:value-of select="changed"/></text>
<text name="fs_beschr"><xsl:value-of select="beschr"/></text>
<text name="fs_type"><xsl:value-of select="type"/></text>
</resource>
</xsl:for-each>
</articlepool>
</xsl:if>
</xsl:for-each>
</xip>
</xsl:template>
</xsl:stylesheet>