hi
I am working on my template to transform xforms to xhtml. with regard to that I
am trying to use javascript in between xslt but its not recognising the stuff
and throwing everything onto the browser as plain text. i am attching my piece
of code advise on changes.
This part of code is to transform my Switch/Case using Toggle from a Select
control:
<xsl:template match="xforms:switch">
<script type="text/javascript">
function switch(selectId)
{
var w = document.getElementById(selectId).selectedIndex;
var name = document.getElementById(selectId).options[w].value;
<xsl:for-each select="xforms:case">
<xsl:variable name="caseId" select="@id"/>
document.getElementById(<xsl:value-of
select="$quot"/><xsl:value-of
select="@id"/><xsl:value-of
select="$quot"/>).style.visibility="hidden";
</xsl:for-each>
document.getElementById(name).style.visibility="visible";
}
</script>
<xsl:for-each select="xforms:case">
<xsl:variable name="caseId" select="@id"/>
<xsl:variable name="disp">
<xsl:choose>
<xsl:when test="@selected ='true()'">visible</xsl:when>
<xsl:otherwise>hidden</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$disp='visible'">
<div id="{$caseId}" style="LEFT:0px; POSITION:relative;
TOP:0px; VISIBILITY:{$disp}; Z-INDEX:0">
<xsl:apply-templates/>
</div>
</xsl:if>
</xsl:for-each>
</xsl:template>
This is my code of Select1 control in xforms:
<!-- Xforms : Select1 -->
<xsl:template match="xforms:select1">
<xsl:variable name="name" as="xs:string" select="@ref"/>
<xsl:variable name="value" as="xs:string" select="@xforms:value"/>
<xsl:variable name="jump">
<xsl:choose>
<xsl:when test="xforms:item/xforms:toggle">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="xforms:label[1]"></xsl:value-of>
<xhtml:select>
<xsl:attribute name="name">
<xsl:call-template name="tail">
<xsl:with-param name="string" select="$name"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:call-template name="tail">
<xsl:with-param name="string" select="$name"/>
</xsl:call-template>
</xsl:attribute>
<xsl:call-template name="copy-other-attributes"/>
<xsl:for-each select="xforms:item">
<!-- Combo box -->
<xhtml:option value="{xforms:value}">
<xsl:call-template name="copy-other-attributes"/>
<xsl:if test="$value = string(xforms:value)">
<xsl:attribute name="selected"
select="'selected'"/>
</xsl:if>
<xsl:value-of select="xforms:label "/>
</xhtml:option>
</xsl:for-each>
<xsl:if test="$jump='true'">
<xsl:attribute name="onchange" select="switch({$name});"/>
</xsl:if>
</xhtml:select>
</xsl:template>
with regards,
Prasad
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--