tag:help-archives.hannonhill.com,2010-02-09:/discussions/xslt-formats/173-trouble-with-outputting-content-generated-from-a-data-def-within-a-wrapping-system-region-tagCascade CMS: Discussion 2015-08-27T20:29:03Ztag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-04-25T13:12:55Z2012-04-25T13:12:55ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Hey James --</p>
<p>Can you paste the XML content that your block is generating and
the format that you're using to transform it?</p>
<p>Feel free to make this thread private if you feel the need based
on the data you'd be attaching.</p>
<p>Thanks.</p></div>Charlie Holdertag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-04-25T14:53:02Z2012-04-26T20:03:50ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><pre>
<code><system-data-structure>
<functionality>
<fctn>alpha</fctn>
</functionality>
<authentication>
<eID>data1</eID>
<eID>data2</eID>
</authentication>
<redir>
<fromto>
<from/>
<to/>
</fromto>
</redir>
</system-data-structure></code>
</pre></div>Jamestag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-04-26T20:07:45Z2012-04-26T20:07:45ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Are you trying to use a Format in a region without a Block? Or
is this Format parsing an actual Block asset?</p>
<p>What kind of Template are you using to output this information?
Are you trying to output this as the only thing in the Template or
is it contained within a larger page structure?</p>
<p>Cascade is going to publish XML compliant code, so if you don't
provide a wrapping element that will be one reason for why it would
want to wrap your output in a system tag.</p>
<p>So you have tried using the START-CODE and END-CODE tags and
those do not seem to be working?</p></div>Charlie Holdertag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-04-26T20:27:22Z2012-04-26T20:27:22ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>The XML is generated by a Data Def tied to the Content Type. I
then have a Format tied to the Configuration Set.</p>
<p>The template is just one line:</p>
<p>I am trying to output this as the only thing.</p>
<p>I am getting an error that I don't have a wrapping element, but
the file I am attempting to generate won't function properly if it
is wrapped.</p>
<p>I changed the Template to use the following:
<!--#START-ROOT-CODE <system-region
name=”DEFAULT”/> #END-ROOT-CODE--> and this did
not work, either.</p>
<p>James "Jamie" Johnson, BBA, MA, A+, ACHDS, HDA, HDM, MOS,
W3S/HTML<br>
JMU Information Technology Web Developer<br>
Browser Detection and Test</p>
<p>"Test everything. Hold on to the good." 1 Thessalonians 5:21<br>
<br>
<br>
</p></div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-05-02T12:44:10Z2012-05-04T03:19:59ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>I have come up with a solution for a "tagless" .htaccess file (a
page called . with extension of htaccess in Cascade). I had to
put</p>
<pre>
<code><xsl:comment>#START-ROOT-CODE</code>
</pre>
<p>before and</p>
<pre>
<code>#ignore:#END-ROOT-CODE</xsl:comment></code>
</pre>
<p>after the content within the xsl:template. The #ignore uses a #
which is a comment in an .htaccess file. This is all done within a
Template that looks like this:</p>
<pre>
<code><pass-through><system-region name="DEFAULT"/></pass-through></code>
</pre>
<p>Here's the XSLT Format:</p>
<pre>
<code><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes" method="xml" omit-xml-declaration="yes"/>
<xsl:template match="system-data-structure">
<xsl:comment>#START-ROOT-CODE
<xsl:variable name="function">
<xsl:value-of select="functionality/fctn"/>
</xsl:variable>
<xsl:if test="$function='Authentication'">
SSLRequireSSL
AuthType Basic
# I removed some statements here that are not to be public
<xsl:variable name="eID">
<xsl:value-of select="authentication/eID"/>
</xsl:variable>
<xsl:for-each select="authentication/eID">
<xsl:choose>
<xsl:when test=".=''">
require valid-user
</xsl:when><!-- end when-->
<xsl:otherwise><!-- Start otherwise, XSL version of else-->
require user <xsl:value-of select="."/>
</xsl:otherwise><!-- end otherwise-->
</xsl:choose><!-- end choose-->
</xsl:for-each>
</xsl:if>
<xsl:if test="$function='Redirect'">
<xsl:for-each select="redir/fromto">
RedirectMatch <xsl:value-of select="concat(from,' ',to)"/>
</xsl:for-each>
</xsl:if>
#ignore:#END-ROOT-CODE</xsl:comment>
</xsl:template>
</xsl:stylesheet></code>
</pre></div>Jamestag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-05-02T20:34:03Z2012-05-02T20:34:03ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>While the XSLT solution works like a charm, I am working on a
similar type of solution for another Format that generates a
non-XML compliant file, but should use Velocity Script. The type of
file does not have multi-line comments that I know of. Any
suggestions on that?</p></div>Jamestag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-05-02T20:44:55Z2012-05-02T20:44:55ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Also noticed that the ignore:#END-ROOT-CODE line should have a #
in front of it to work. For whatever reason, it did not render that
way.</p></div>Jamestag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-05-02T20:50:11Z2012-05-02T20:50:12ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Charlie, sorry about all the messages, but in case someone else
sees this, I want to ensure the XSLT htaccess solution is helpful.
So, I have attached it in a file.</p></div>Jamestag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-06-21T18:52:09Z2012-06-21T18:52:09ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Hi James,</p>
<p>I was going over some older discussions and noticed this one is
still open. Were you able to get a Velocity Format equivalent to
the XSLT working?</p>
<p>Please feel free to let us know if you have any other
questions.</p>
<p>Thanks.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-06-26T13:58:58Z2012-06-26T18:35:12ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>I was unable to get the Velocity Format equivalent to work.<br>
<br>
</p></div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-06-26T19:44:03Z2012-06-26T19:44:03ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>James, my apologies I had not realized you were posting under
two usernames.</p>
<p>Using the XML you <a href="">posted previously</a>, I made an
attempt at creating a Velocity Format (see below) that mimics the
XSLT you posted.</p>
<p>To set up, reuse the same set up as you <a href=
"http://help.hannonhill.com/discussions/xslt-formats/173-trouble-with-outputting-content-generated-from-a-data-def-within-a-wrapping-system-region-tag#comment_15714733">
described above</a> but replace the XSLT Format with the Velocity
Format below.</p>
<p>Please let me know how this works out.</p>
<p>Thanks.</p>
<pre>
<code><!--#START-ROOT-CODE
## Abstract out the "system-data-structure" node
#set ( $sds = $_XPathTool.selectSingleNode($contentRoot, "/system-data-structure") )
#set ( $functionality = $_XPathTool.selectSingleNode($sds, "functionality/fctn") )
#set ( $safeFunctionality = $_EscapeTool.xml($functionality.value) )
#if ($safeFunctionality == "Authentication")
#set ( $eID = $_XPathTool.selectNodes($sds, "authentication/eID[.!='']") )
#if ($eID.size() > 0)
SSLRequireSSL
AuthType Basic
#foreach ($id in $eID)
require user ${_EscapeTool.xml($id.value)}
#end
#end
#elseif ($safeFunctionality == "Redirect")
#set ( $redirects = $_XPathTool.selectNodes($sds, "redir/fromto[from!='' and to!='']") )
#if ($redirects.size() > 0)
#foreach ( $r in $redirects )
#set ( $safeFrom = $_EscapeTool.xml($r.getChild("from").value) )
#set ( $safeTo = $_EscapeTool.xml($r.getChild("to").value) )
RedirectMatch ${safeFrom} ${safeTo}
#end
#end
#end
#ignore:#END-ROOT-CODE--></code>
</pre></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-17T18:51:48Z2012-07-17T18:51:48ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Hi James,</p>
<p>Just wanted to follow up to see if you had a chance to view my
<a href=
"http://help.hannonhill.com/discussions/xslt-formats/173-trouble-with-outputting-content-generated-from-a-data-def-within-a-wrapping-system-region-tag#comment_16912052">
recent comment</a>.</p>
<p>Please let us know if you have any questions.</p>
<p>Thanks.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-17T19:24:33Z2012-07-17T19:24:33ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Ryan,</p>
<p>I hope to get to that either this week or next week. Thanks for
following up!</p>
<p>James "Jamie" Johnson, BBA, MA, A+, ACHDS, HDA, HDM, MOS,
W3S/HTML<br>
JMU Information Technology Web Developer<br>
Browser Detection and Test</p>
<p>"Test everything. Hold on to the good." 1 Thessalonians 5:21<br>
<br>
<br>
</p></div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T18:38:14Z2012-07-25T18:38:14ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Hi James,</p>
<p>I wanted to follow up to see if you had a chance to look into my
<a href=
"http://help.hannonhill.com/discussions/xslt-formats/173-trouble-with-outputting-content-generated-from-a-data-def-within-a-wrapping-system-region-tag#comment_16912052">
comment above</a> and whether or not that helped you out.</p>
<p>Thanks.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T19:03:22Z2012-07-25T19:03:22ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Ryan,</p>
<p>I modified my code to use the START CODE and ignore in the
manner yours does and there is progress. However, it does not fully
work as desired. Looking further into it, however, I have
determined that this is a limitation of items outside of Cascade.
The Configuration file generated by the Format is close to what I
need, but cgi script used to process it is "too picky" without some
further manual modifications of the Configuration file. This is a
limitation of the cgi script. I would say this is closed since it
appears I will have to come up with a different solution that works
better with a Cascade implementation. Thanks for looking into
it!</p>
<p>James "Jamie" Johnson, BBA, MA, A+, ACHDS, HDA, HDM, MOS,
W3S/HTML<br>
JMU Information Technology Web Developer<br>
Browser Detection and Test</p>
<p>"Test everything. Hold on to the good." 1 Thessalonians 5:21<br>
<br>
<br>
</p></div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T19:16:07Z2012-07-25T19:16:07ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Thank you for the followup, James.</p>
<p>Perhaps you could just host the static file within Cascade and
publish it to the server? This would at least give you the benefits
of user access/security and revisions.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T19:18:50Z2012-07-25T19:18:50ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>I could, but the Configuration file has items in it that have a
1:1 relationship with items on a form. I was generating 2 files
(form and configuration) with one data def-driven base asset.</p>
<p>James "Jamie" Johnson, BBA, MA, A+, ACHDS, HDA, HDM, MOS,
W3S/HTML<br>
JMU Information Technology Web Developer<br>
Browser Detection and Test</p>
<p>"Test everything. Hold on to the good." 1 Thessalonians 5:21<br>
<br>
<br>
</p></div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T19:54:22Z2012-07-25T19:54:22ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Ah, true I forgot about that part.</p>
<p>What portion of the generated file does the CGI not like?</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T19:56:22Z2012-07-25T19:56:22ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Some of the spacing between items (above, below). The CGI is
quite (too) picky.</p>
<p>James "Jamie" Johnson, BBA, MA, A+, ACHDS, HDA, HDM, MOS,
W3S/HTML<br>
JMU Information Technology Web Developer<br>
Browser Detection and Test</p>
<p>"Test everything. Hold on to the good." 1 Thessalonians 5:21<br>
<br>
<br>
</p></div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T20:00:02Z2012-07-25T20:00:02ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Would you be able to provide a working example and an example of
what is being generated by the Format? Perhaps there is some
tweaking that could be done to handle whitespace a bit better.</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-25T20:44:11Z2012-07-25T20:44:11ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Ryan,</p>
<p>The working example uses multiple folders, files, Blocks, and
Formats - all generated by the folder-based Base Asset. Would it be
most helpful to show the generated XML and the Formats for the
various files and then send attachments of the files that are
generated?</p>
<p>James "Jamie" Johnson, BBA, MA, A+, ACHDS, HDA, HDM, MOS,
W3S/HTML<br>
JMU Information Technology Web Developer<br>
Browser Detection and Test</p>
<p>"Test everything. Hold on to the good." 1 Thessalonians 5:21<br>
<br>
<br>
</p></div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-30T13:10:54Z2012-07-30T13:10:54ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Hi James,</p>
<p>Yes, if you could provide the following so I can try to tweak
things in my local instance that would be great:</p>
<ul>
<li>an example of a file that is generated</li>
<li>a copy of the Format</li>
<li>a copy of the XML being formatted (will make things easier to
reproduce from my instance)</li>
</ul>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-30T13:32:08Z2012-07-30T13:32:08ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Ryan,</p>
<h6>#</h6>
<p>Here is the XML:</p>
<h6>#</h6>
<p><br>
<br>
<br>
<br>
<br>
Test Form<br>
<a href="mailto:johns2ja@jmu.edu">johns2ja@jmu.edu</a><br>
test<br>
<br>
Mailer<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Enter a word<br>
Yes<br>
Yes<br>
None<br>
<br>
<br>
Enter a number<br>
Yes<br>
No<br>
Number<br>
<br>
<br>
Enter a thought<br>
Yes<br>
No<br>
None<br>
<br>
<br>
Check these out<br>
<br>
<br>
Lions<br>
<br>
<br>
<br>
Tigers<br>
<br>
<br>
<br>
Bears<br>
<br>
Yes<br>
No<br>
<br>
<br>
Exclaim<br>
<br>
<br>
Oh<br>
<br>
<br>
<br>
My!<br>
<br>
Yes<br>
No<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
bravo!<br>
<br>
<br>
well done....<br>
<br>
<br>
<br>
/forms/test/testing/_cascade/doformdetail<br>
JMU<br>
doformdetail<br>
DoForm Detail<br>
DoForm Detail<br>
<br></p>
<h6>#</h6>
<p>Here is the Velocity Format:</p>
<h6>#</h6>
<!--#START-ROOT-CODE [system-view:internal] #set($cfgname =
$_XPathTool.selectSingleNode($contentRoot,
'/system-data-structure/block/content/system-data-structure/setup/cfg').value)
#if($cfgname != '') ## do nothing #else #set($cfgname = "myform")
#end <div style="background:#fffccc;border:2px solid <a
href="/discussions/xslt-formats/450084" title="Discussion
#450084">#450084</a>;padding:5px;">
<h2>***DEVELOPER NOTES:</h2> <p>This will
<b>not appear</b> in the published CFG file.</p>
<p>Per your specifications, this file should be named
<b>$cfgname</b>.</p> </div>
[/system-view:internal] ## DoForm Builder by James Arthur "Jamie"
Johnson (johns2ja) #set($csvname =
$_XPathTool.selectSingleNode($contentRoot,
'/system-data-structure/block/content/system-data-structure/setup/csv').value)
#if($csvname != '') ## do nothing #else #set($csvname = "data")
#end #set($delimiter = $_XPathTool.selectSingleNode($contentRoot,
'/system-data-structure/block/content/system-data-structure/setup/delimiter').value)
#if($delimiter != ',' or $delimiter != '~') #set($delimiter = ',')
#end #set($htmlpre =
$_SerializerTool.serialize($_XPathTool.selectSingleNode($contentRoot,
'/system-data-structure/block/content/system-data-structure/htmlresponse/htmlpre').value,
true)) #set($htmlpost =
$_SerializerTool.serialize($_XPathTool.selectSingleNode($contentRoot,
'/system-data-structure/block/content/system-data-structure/htmlresponse/htmlpost').value,
true)) #set( $functionality1 = 0) #set( $functionality2 = 0) #set(
$functionvalues =
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/setup/functionality/value'))
#foreach($value in $functionvalues) #if( $value.value == 'Mailer' )
#set( $functionality1 = 1 ) #end #if( $value.value == 'Save-As' )
#set( $functionality2 = 1 ) #end #end #set($pipe = 'false') ##TEXT
INPUT #set($inputnum = 0) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textinputoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $inputnum =
$inputnum + 1 ) #if($node.getChild('required').value == 'Yes')
#if($pipe == 'false') #set($pipe = 'true') #else | #end REQUIRE
INPUT$inputnum The text input field for
$node.getChild('label').value is required.<br /> #end #end
#end ##TEXT AREA #set($textareanum = 0) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textareaoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $textareanum =
$textareanum + 1 ) #if($node.getChild('required').value == 'Yes')
#if($pipe == 'false') #set($pipe = 'true') #else | #end REQUIRE
TEXTAREA$textareanum The textarea for $node.getChild('label').value
is required.<br /> #end #end #end ##CHECKBOXES
#set($checkboxnum= 0) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/checkboxoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $checkboxnum=
$checkboxnum+ 1 ) #if($node.getChild('required').value == 'Yes')
#if($pipe == 'false') #set($pipe = 'true') #else | #end REQUIRE
CHECKBOX$checkboxnum The checkboxes for
$node.getChild('label').value are required.<br /> #end #end
#end ##DROPDOWNS #set( $dropdownnum = 0 ) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/dropdownoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $dropdownnum=
$dropdownnum+ 1 ) #if($node.getChild('required').value == 'Yes')
#if($pipe == 'false') #set($pipe = 'true') #else | #end REQUIRE
OPTIONS$dropdownnum The dropdown menu for
$node.getChild('label').value is required.<br /> #end #end
#end ##RADIO #set( $radionum = 0 ) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/radiooptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $radionum =
$radionum + 1 ) #if($node.getChild('required').value == 'Yes')
#if($pipe == 'false') #set($pipe = 'true') #else | #end REQUIRE
RADIO$radionum The radio buttons for $node.getChild('label').value
are required.<br /> #end #end #end ##DATEPICKER #set(
$datenum = 0 ) #foreach($node in
$_XPathTool.selectNodes($contentRoot,
'/system-data-structure/block/content/system-data-structure/datepicker'))
#if($node.getChild('usethis').value == 'Yes') #set( $datenum =
$datenum + 1 ) #if($node.getChild('required').value == 'Yes' )
#if($pipe == 'false') #set($pipe = 'true') #else | #end REQUIRE
DATE$datenum The date for $node.getChild('label').value are
required.<br /> #end #end #end ## RECIPIENT(S) #if(
$functionality1 == 1 ) |<br /> MAIL-TO #set( $recipients =
$_XPathTool.selectNodes($contentRoot,
'/system-data-structure/block/content/system-data-structure/setup/recipient'))
#set($totalrecipients = 0) #foreach( $x in $recipients )
#set($totalrecipients = $foreach.count) #end #foreach( $recipient
in $recipients ) $recipient.value#if($foreach.count !=
$totalrecipients),#end #end
$_XPathTool.selectSingleNode($contentRoot,
'/system-data-structure/block/content/system-data-structure/setup/subject').value<br
/> #outputdata('<br />') <br /> #end ##HTML RESPONSE
| RESPOND HTML #if($htmlpre) $htmlpre #end <br /> <div
style="color:black"> <p>You submitted the
following:</p> #outputdata('<br />') <br />
</div> #if($htmlpost) $htmlpost #end <br /> ## SAVING
#if( $functionality2 == 1 ) |<br /> SAVE-AS ${csvname}<br
/> #outputdata($delimiter) #end ##OUTPUT MACRO #macro(outputdata
$char) #set($outputfinal = '') ##TEXT INPUT #set($inputnum = 0)
#foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textinputoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $inputnum =
$inputnum + 1 ) #if($char != ',' and $char !='~') ## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+":
") #end #set($outputfinal = $outputfinal +
"|input"+$inputnum+"|"+$char) #end #end ##TEXT AREA
#set($textareanum = 0) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textareaoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $textareanum =
$textareanum + 1 ) #if($char != ',' and $char !='~') ## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+":
") #end #set($outputfinal = $outputfinal +
"|textarea"+$textareanum+"|"+$char) #end #end ##CHECKBOXES
#set($checkboxnum= 0) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/checkboxoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $checkboxnum=
$checkboxnum+ 1 ) #if($char != ',' and $char !='~') ## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+":
") #end #set($outputfinal = $outputfinal +
"|checkbox"+$checkboxnum+"|"+$char) #end #end ##DROPDOWNS #set(
$dropdownnum = 0 ) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/dropdownoptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $dropdownnum=
$dropdownnum+ 1 ) #if($char != ',' and $char !='~') ## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+":
") #end #set($outputfinal = $outputfinal +
"|options"+$optionsnum+"|"+$char) #end #end ##RADIO #set( $radionum
= 0 ) #foreach($node in
$_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/radiooptions'))
#if($node.getChild('usethis').value == 'Yes') #set( $radionum =
$radionum + 1 ) #if($char != ',' and $char !='~') ## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+":
") #end #set($outputfinal = $outputfinal +
"|radio"+$radionum+"|"+$char) #end #end ##DATEPICKER #set( $datenum
= 0 ) #foreach($node in $_XPathTool.selectNodes($contentRoot,
'/system-data-structure/block/content/system-data-structure/datepicker'))
#if($node.getChild('usethis').value == 'Yes') #set( $datenum =
$datenum + 1 ) #if($char != ',' and $char !='~') ## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+":
") #end #set($outputfinal = $outputfinal +
"|date"+$datenum+"|"+$char) #end #end #set($outputfinal =
$outputfinal + "EOF") #set($eof = $char + "EOF")
$_StringTool.substringBefore($outputfinal, $eof) #end
###############################################################################################
Here is the output (lots of extra spacing):
###############################################################################################
REQUIRE INPUT1 The text input field for Enter a word is
required.<br /> |<br /> MAIL-TO johns2ja@jmu.edu
test<br /> Enter a word: |input1|<br />Enter a number:
|input2|<br />Enter a thought: |textarea1|<br />Check
these out: |checkbox1|<br />Exclaim: |checkbox2| <br />
| RESPOND HTML <br /> <div style="color:black">
<p>You submitted the following:</p> Enter a word:
|input1|<br />Enter a number: |input2|<br />Enter a
thought: |textarea1|<br />Check these out: |checkbox1|<br
/>Exclaim: |checkbox2| <br /> </div> <br />
###############################################################################################
And here is what it should look like:
###############################################################################################
REQUIRE INPUT1 The text input field for Enter a word is
required.<br /> | MAIL-TO johns2ja@jmu.edu test Enter a word:
|input1| Enter a number: |input2| Enter a thought: |textarea1|
Check these out: |checkbox1| Exclaim: |checkbox2| | RESPOND HTML
<div style="color:black"> <p>You submitted the
following:</p> Enter a word: |input1|<br /> Enter a
number: |input2|<br /> Enter a thought: |textarea1|<br
/> Check these out: |checkbox1|<br /> Exclaim: |checkbox2|
<br /> </div> <br />
###############################################################################################
###############################################################################################
James "Jamie" Johnson, BBA, MA, A+, ACHDS, HDA, HDM, MOS, W3S/HTML
JMU Information Technology Web Developer Browser Detection and Test
"Test everything. Hold on to the good." 1 Thessalonians 5:21
</div>Johnson, James Arthur - johns2jatag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-07-30T15:08:17Z2012-07-30T15:08:17ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>James,</p>
<p>From what I am reading on the <a href=
"http://wiki.apache.org/velocity/VelocityWhitespaceTruncatedByLineComment">
Velocity Wiki</a>, whitespace control within the language is still
on ongoing debate; however, this page does offer a few
"workarounds" to remove the whitespace. The most common workarounds
are to remove all indentation and unnecessary line breaks, and
adding an empty comment <code>##</code> to the end of lines that do
require a line break (or end up adding an extra line).</p>
<p>That said, one downside to this is that it leaves the velocity
very difficult to read. The <a>page I linked to above</a>) offers a
few suggestions and this <a href=
"http://stackoverflow.com/questions/5788426/how-to-configure-velocity-template-engine-to-avoid-automatic-carriage-return-in">
stackoverflow page</a> offers a few additional methods to at least
attempt to add some spacing to the Format to make it a little
easier to read. Still far from clean, unfortunately.</p>
<p>The following Format <em>seemed</em> to remove all extra line
breaks and spacing using the XML you provided; however, as you will
see, it's pretty ugly. I also had to remove unnecessary trailing
spaces from a large number of lines:</p>
<pre>
<code><!--#START-ROOT-CODE##
[system-view:internal]
#set($cfgname = $_XPathTool.selectSingleNode($contentRoot, '/system-data-structure/block/content/system-data-structure/setup/cfg').value)
#if($cfgname != '')
## do nothing
#else
#set($cfgname = "myform")
#end
<div style="background:#fffccc;border:2px solid #450084;padding:5px;">
<h2>***DEVELOPER NOTES:</h2>
<p>This will <b>not appear</b> in the published CFG file.</p>
<p>Per your specifications, this file should be named <b>$cfgname</b>.</p>
</div>##
[/system-view:internal]
## DoForm Builder by James Arthur "Jamie" Johnson (johns2ja)
#set($csvname = $_XPathTool.selectSingleNode($contentRoot, '/system-data-structure/block/content/system-data-structure/setup/csv').value)
#if($csvname != '')
## do nothing
#else
#set($csvname = "data")
#end
#set($delimiter = $_XPathTool.selectSingleNode($contentRoot, '/system-data-structure/block/content/system-data-structure/setup/delimiter').value)
#if($delimiter != ',' or $delimiter != '~')
#set($delimiter = ',')
#end
#set($htmlpre = $_SerializerTool.serialize($_XPathTool.selectSingleNode($contentRoot, '/system-data-structure/block/content/system-data-structure/htmlresponse/htmlpre').value, true))
#set($htmlpost = $_SerializerTool.serialize($_XPathTool.selectSingleNode($contentRoot, '/system-data-structure/block/content/system-data-structure/htmlresponse/htmlpost').value, true))
#set($functionality1 = 0)
#set($functionality2 = 0)
#set($functionvalues = $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/setup/functionality/value'))
#foreach($value in $functionvalues)
#if( $value.value == 'Mailer')
#set($functionality1 = 1)
#end
#if( $value.value == 'Save-As')
#set($functionality2 = 1)
#end
#end
#set($pipe = 'false')
##TEXT INPUT
#set($inputnum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textinputoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($inputnum = $inputnum + 1)
#if($node.getChild('required').value == 'Yes')
#if($pipe == 'false')
#set($pipe = 'true')
#else
|
#end
REQUIRE INPUT$inputnum
The text input field for $node.getChild('label').value is required.<br />##
#end
#end
#end
##TEXT AREA
#set($textareanum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textareaoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($textareanum = $textareanum + 1)
#if($node.getChild('required').value == 'Yes')
#if($pipe == 'false')
#set($pipe = 'true')
#else
|
#end
REQUIRE TEXTAREA$textareanum
The textarea for $node.getChild('label').value is required.<br />##
#end
#end
#end
##CHECKBOXES
#set($checkboxnum= 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/checkboxoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($checkboxnum= $checkboxnum+ 1)
#if($node.getChild('required').value == 'Yes')
#if($pipe == 'false')
#set($pipe = 'true')
#else
|
#end
REQUIRE CHECKBOX$checkboxnum
The checkboxes for $node.getChild('label').value are required.<br />
#end
#end
#end
##DROPDOWNS
#set($dropdownnum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/dropdownoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($dropdownnum= $dropdownnum+ 1)
#if($node.getChild('required').value == 'Yes')
#if($pipe == 'false')
#set($pipe = 'true')
#else
|
#end
REQUIRE OPTIONS$dropdownnum
The dropdown menu for $node.getChild('label').value is required.<br />
#end
#end
#end
##RADIO
#set($radionum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/radiooptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($radionum = $radionum + 1)
#if($node.getChild('required').value == 'Yes')
#if($pipe == 'false')
#set($pipe = 'true')
#else
|
#end
REQUIRE RADIO$radionum
The radio buttons for $node.getChild('label').value are required.<br />
#end
#end
#end
##DATEPICKER
#set($datenum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot, '/system-data-structure/block/content/system-data-structure/datepicker'))
#if($node.getChild('usethis').value == 'Yes')
#set($datenum = $datenum + 1)
#if($node.getChild('required').value == 'Yes')
#if($pipe == 'false')
#set($pipe = 'true')
#else
|
#end
REQUIRE DATE$datenum
The date for $node.getChild('label').value are required.<br />
#end
#end
#end
## RECIPIENT(S)
#if( $functionality1 == 1)
|<br />
MAIL-TO
#set($recipients = $_XPathTool.selectNodes($contentRoot, '/system-data-structure/block/content/system-data-structure/setup/recipient'))
#set($totalrecipients = 0)
#foreach( $x in $recipients)
#set($totalrecipients = $foreach.count)
#end
#foreach( $recipient in $recipients)
$recipient.value#if($foreach.count != $totalrecipients),#end
#end
$_XPathTool.selectSingleNode($contentRoot, '/system-data-structure/block/content/system-data-structure/setup/subject').value<br />
#outputdata('<br />')##
<br />
#end
##HTML RESPONSE
|
RESPOND HTML
#if($htmlpre)
$htmlpre
#end
<br />
<div style="color:black">
<p>You submitted the following:</p>
#outputdata('<br />')
<br />
</div>
#if($htmlpost)
$htmlpost
#end
<br />
## SAVING
#if( $functionality2 == 1)
|<br />
SAVE-AS ${csvname}<br />
#outputdata($delimiter)
#end
##OUTPUT MACRO
#macro(outputdata $char)
#set($outputfinal = '')
##TEXT INPUT
#set($inputnum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textinputoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($inputnum = $inputnum + 1)
#if($char != ',' and $char !='~')## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+": ")
#end
#set($outputfinal = $outputfinal + "|input"+$inputnum+"|"+$char)
#end
#end
##TEXT AREA
#set($textareanum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/textareaoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($textareanum = $textareanum + 1)
#if($char != ',' and $char !='~')## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+": ")
#end
#set($outputfinal = $outputfinal + "|textarea"+$textareanum+"|"+$char)
#end
#end
##CHECKBOXES
#set($checkboxnum= 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/checkboxoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($checkboxnum= $checkboxnum+ 1)
#if($char != ',' and $char !='~')## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+": ")
#end
#set($outputfinal = $outputfinal + "|checkbox"+$checkboxnum+"|"+$char)
#end
#end
##DROPDOWNS
#set($dropdownnum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/dropdownoptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($dropdownnum= $dropdownnum+ 1)
#if($char != ',' and $char !='~')## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+": ")
#end
#set($outputfinal = $outputfinal + "|options"+$optionsnum+"|"+$char)
#end
#end
##RADIO
#set($radionum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot,'/system-data-structure/block/content/system-data-structure/radiooptions'))
#if($node.getChild('usethis').value == 'Yes')
#set($radionum = $radionum + 1)
#if($char != ',' and $char !='~')## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+": ")
#end
#set($outputfinal = $outputfinal + "|radio"+$radionum+"|"+$char)
#end
#end
##DATEPICKER
#set($datenum = 0)
#foreach($node in $_XPathTool.selectNodes($contentRoot, '/system-data-structure/block/content/system-data-structure/datepicker'))
#if($node.getChild('usethis').value == 'Yes')
#set($datenum = $datenum + 1)
#if($char != ',' and $char !='~')## not SAVE-AS
#set($outputfinal = $outputfinal + $node.getChild('label').value+": ")
#end
#set($outputfinal = $outputfinal + "|date"+$datenum+"|"+$char)
#end
#end
#set($outputfinal = $outputfinal + "EOF")
#set($eof = $char + "EOF")
$_StringTool.substringBefore($outputfinal, $eof)
#end
#END-ROOT-CODE --></code>
</pre></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/153705642012-08-06T19:45:11Z2012-08-06T19:45:11ZTrouble with outputting content generated from a Data Def within a wrapping <system-region> tag<div><p>Hi James,</p>
<p>Just wanted to follow up to see if you had a chance to view my
<a href=
"http://help.hannonhill.com/discussions/xslt-formats/173-trouble-with-outputting-content-generated-from-a-data-def-within-a-wrapping-system-region-tag#comment_17699767">
recent comment</a>.</p>
<p>Please let us know if you have any questions.</p>
<p>Thanks.</p></div>Ryan Griffith