String2XMLTransformer
Note
Preliminary information. Treat with caution.
There are occasions when it is necessary to translate a string into an equivalent DOM structure.Currently there is a single attribute
- root-node — the containing node of the string to be translated.
For example in the experimental Paloose CMS the editor (TinyMCE)
the updated (saved) content is sent to the server as a POST string. This is an HTML raw string that must be converted into a HTML DOM.
<map:pipeline>
<map:match pattern="updatePage.html">
<map:act type="auth-protect">
<map:parameter name="handler" value="adminHandler"/>
<map:aggregate element="root">
<map:part src="cocoon:/updatePage-result.xml" element="updatePage-result"
strip-root="true"/>
<map:part src="cocoon:/updatePage-2.xml" element="updatePage-page"
strip-root="true"/>
</map:aggregate>
<!-- Display result and edit page -->
</map:act>
</map:match>
</map:pipeline>
<!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
<map:pipeline internal-only="yes">
<map:match pattern="updatePage-result.xml">
<map:generate src="{global:themesDir}/{global:currentTheme}/data/body.xml" type="px"
label="raw-xml"/>
<map:transform src="{global:adminDir}/resources/transforms/updatePage.xsl"
label="updatePage-transform">
<map:parameter name="whichArticle" value="{request-param:whichArticle}"/>
<map:parameter name="editField" value="{request-param:editField}"/>
<map:parameter name="requestId" value="edit"/>
<map:parameter name="siteIdent" value="{request-param:site}"/>
<map:parameter name="themesDir" value="{global:themesDir}"/>
<map:parameter name="theme" value="{global:currentTheme}"/>
<map:parameter name="defaultTheme" value="{global:defaultTheme}"/>
<map:parameter name="rootDir" value="{global:rootDir}"/>
<map:parameter name="queryString" value="{global:query-string}"/>
<map:parameter name="admin" value="1"/>
</map:transform>
<map:transform type="string2xml" label="string2xml-transform">
<map:parameter name="root-node" value="pcms:editField"/>
</map:transform>
<map:transform src="{global:adminDir}/resources/transforms/normalizeEdit.xsl"
label="updatePage-transform"/>
<map:transform type="variables" label="buildVariables-transform"/>
<map:transform type="sourceWrite" label="buildVariables-transform"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="updatePage-page.xml">
<map:generate src="{global:themesDir}/{global:currentTheme}/data/body.xml" type="px"
label="raw-xml"/>
<map:transform src="{global:systemDir}/resources/transforms/buildBody.xsl"
label="buildBody-transform">
<map:parameter name="requestId" value="{request-param:reqid}"/>
<map:parameter name="siteIdent" value="{request-param:site}"/>
<map:parameter name="themesDir" value="{global:themesDir}"/>
<map:parameter name="theme" value="{global:currentTheme}"/>
<map:parameter name="defaultTheme" value="{global:defaultTheme}"/>
<map:parameter name="rootDir" value="{global:rootDir}"/>
<map:parameter name="queryString" value="{global:query-string}"/>
<map:parameter name="admin" value="1"/>
</map:transform>
<map:transform src="{global:adminDir}/resources/transforms/buildAdminPanels.xsl"
label="buildPanels-transform"/>
<map:transform src="{global:adminDir}/resources/transforms/buildAdminSite.xsl"
label="buildSite-transform"/>
<map:transform type="variables" label="buildVariables-transform"/>
<map:transform type="directory" label="directory-transform"/>
<map:transform src="{global:adminDir}/resources/transforms/buildPagesList.xsl"
label="buildPagesList-transform"/>
<map:serialize type="xml"/>
</map:match>
which builds an XML page which contains the POSTed string as an XML scrap for writing back into the article file being edited.
Copyright 2006 – 2023 Hugh Field-Richards. All Rights Reserved.