tag:help-archives.hannonhill.com,2010-02-09:/discussions/xslt-formats/3069-adding-another-data-definition-feature-using-xsltCascade CMS: Discussion 2013-10-23T19:00:41Ztag:help-archives.hannonhill.com,2010-02-09:Comment/295590432013-10-23T15:18:50Z2013-10-23T15:18:50ZAdding another Data Definition feature using XSLT<div><p>Hi Matthew,</p>
<p>To add the additional field, you would add the new text field
below the page chooser with a helpful label such as <strong>- OR -
External URL</strong>. Then your Format, the
<strong>dropdown</strong> template would need to be tweaked to use
a <code><xsl:choose></code> instead of
<code><xsl:if></code> so you can look for a chosen page, then
check for a URL, and then fallback to nothing at all.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/295590432013-10-23T17:58:59Z2013-10-23T17:58:59ZAdding another Data Definition feature using XSLT<div><p>I added the text field, I labeled "external", below the page
chooser but I'm having problems changing the
<code><xsl:if></code> to <code><xsl:choose></code></p>
<p>I got an error saying I can't have a <code><xsl:if
test></code> within a <code><xsl:choose></code></p>
<pre>
<code> <xsl:template match="dropdown">
<xsl:if test="(display = 'Yes') and (item/link-text != '')">
<select class="treat-as-links">
<option>Please Select</option>
<xsl:for-each select="item">
<option>
<xsl:if test="page/path != '/'">
<xsl:attribute name="value">[system-asset]<xsl:value-of select="page/link"/>[/system-asset]</xsl:attribute>
</xsl:if>
<xsl:value-of select="link-text"/></option>
</xsl:for-each>
</select>
</xsl:if>
</xsl:template></code>
</pre></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/295590432013-10-23T18:28:28Z2013-10-23T18:28:28ZAdding another Data Definition feature using XSLT<div><p>Hi Matthew,</p>
<p>The <code><xsl:choose></code> element's children are
<code><xsl:when></code> and
<code><xsl:otherwise></code>, which would explain the error
message. More information about this element can be found here.</p>
<p>When you have a moment, try the following and let me know how it
works out:</p>
<pre>
<code> <xsl:template match="dropdown">
<xsl:if test="(display = 'Yes') and (item/link-text != '')">
<select class="treat-as-links">
<option>Please Select</option>
<xsl:for-each select="item">
<option>
<xsl:choose>
<xsl:when test="page/path != '/'">
<xsl:attribute name="value">[system-asset]<xsl:value-of select="page/link"/>[/system-asset]</xsl:attribute>
</xsl:when>
<xsl:when test="external != '' and external != 'http://'">
<xsl:attribute name="value"><xsl:value-of select="external"/></xsl:attribute>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
<xsl:value-of select="link-text"/></option>
</xsl:for-each>
</select>
</xsl:if>
</xsl:template></code>
</pre>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/295590432013-10-23T18:46:20Z2013-10-23T18:46:20ZAdding another Data Definition feature using XSLT<div><p>That worked like a charm! Thanks again Ryan!</p></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/295590432013-10-23T19:00:40Z2013-10-23T19:00:40ZAdding another Data Definition feature using XSLT<div><p>Not a problem at all, Matthew. I am glad to hear that did the
trick.</p>
<p>Have a great day!</p></div>Ryan Griffith