(note: [rt]'s are little [RT]s ;)
In Forrest-land, we are using the ResourceExistsAction to handle the
possibility of different input formats. Eg., if index.ehtml or
index.ihtml is present, it will be used in preference to index.xml:
<map:match pattern="**.xml">
<map:act type="resource-exists">
<map:parameter name="url" value="content/xdocs/{1}.ihtml" />
<map:generate src="content/xdocs/{../1}.ihtml" type="html" />
<map:transform src="resources/stylesheets/html2document.xsl" />
<map:transform type="idgen" />
<map:serialize type="xml"/>
</map:act>
<map:act type="resource-exists">
<map:parameter name="url" value="content/xdocs/{1}.ehtml" />
<map:generate src="content/xdocs/{../1}.ehtml" />
<map:transform src="resources/stylesheets/html2htmlbody.xsl" />
<map:serialize type="xml" />
</map:act>
<map:generate src="content/xdocs/{1}.xml" />
<map:call resource="transform-to-document">
<map:parameter name="src" value="content/xdocs/{1}.xml" />
</map:call>
<map:serialize type="xml"/>
</map:match>
I rather think that we are abusing Actions here, because
ResourceExistsAction doesn't actually perform any "action": it's just
a selector.
So I wrote a ResourceExistsSelector:
<map:select type="resource-exists">
<map:when test="/content/xdocs/{1}.ihtml">
<map:generate src="content/xdocs/{1}.ihtml" type="html" />
<map:transform src="resources/stylesheets/html2document.xsl" />
<map:transform type="idgen" />
<map:serialize type="xml"/>
</map:when>
<map:when test="/content/xdocs/{1}.ehtml">
<map:generate src="content/xdocs/{1}.ehtml" />
<map:transform src="resources/stylesheets/html2htmlbody.xsl" />
<map:serialize type="xml" />
</map:when>
<map:otherwise>
<map:generate src="content/xdocs/{1}.xml" />
<map:call resource="transform-to-document">
<map:parameter name="src" value="content/xdocs/{1}.xml" />
</map:call>
<map:serialize type="xml"/>
</map:otherwise>
</map:select>
It seems much clearer to have:
<map:when test="/content/xdocs/{1}.ehtml">
than:
<map:act type="resource-exists">
<map:parameter name="url" value="content/xdocs/{1}.ehtml" />
And especially, the <map:otherwise> makes it very clear when that
section is executed.
So, can I check this in, deprecate ResourceExistsAction, and we all
live happily ever after?
--Jeff