Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2740

Re: WPC - Custom Web Form: DOMException: Root Element is already present

$
0
0

This is and old question, but I faced same problem today.

The result of the XSLT transformation MUST be within an only root element. Your code should be like this:

 

<?xml version="1.0"?>

<!DOCTYPE stylesheet [

<!ENTITY apos  "&#39;" ><!-- replace &apos; with html escape character for ' -->

]>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wpc="com.sap.nw.wpc.km.service.editor.hslt.XsltHelperCore">

  <xsl:output method="html"/>

  <xsl:template match="/">

   <div>

    <h1 id="informatics_h1"> <xsl:value-of disable-output-escaping="yes" select="document/elements/element[@type='heading1']" /> </h1>

    <h2 id="informatics_h2"> <xsl:value-of disable-output-escaping="yes" select="document/elements/element[@type='heading2']" /> </h2>

    <xsl:for-each select="document/elements/element">

      <xsl:if test="@type='paragraph'">

        <xsl:value-of disable-output-escaping="yes" select="current()" />

      </xsl:if>

      <xsl:if test="@type='relatedLinks'">

        <div id="informatics_related_links"> Siehe auch: <a>

          <xsl:attribute name="href"> <xsl:value-of disable-output-escaping="yes" select="wpc:getAccessLink(string(@rid), string(/document/@locale))"/> </xsl:attribute>

          <xsl:value-of disable-output-escaping="yes" select="@heading1"/> </a> </div>

      </xsl:if>

    </xsl:for-each>

    </div>

  </xsl:template>

</xsl:stylesheet>


Viewing all articles
Browse latest Browse all 2740

Trending Articles