working on it ...

Filters

Explore Public Snippets

Sort by

Found 4 snippets

    public by cghersi  185245  1  6  1

    Use the Raw HTML content in XSLT transformations

    Usage of copy-of element allows to get the exact content of an XML node and put it as raw HTML, so that e.g. are not stripped out as instead happens with
    <myXmlNode>
    	<question>
    	Some text <br/> separated < br/> by new lines
    	</question>
    </myXmlNode>
    
    <span>
    	<xsl:copy-of select="question"/>
    </span>

    public by Percival  3220  0  6  1

    Usage of xsl:if operator in XSLT

    Simple yet effective example of xsl:if condition in templates and transformations
    <span style="color:ff8500;">
      <xsl:if test="@RefersTo = 'SomeValue'">
        <xsl:value-of select="@MyAttr"/>
      </xsl:if>
    </span>

    public by Crater  2805  0  6  0

    Usage of choose operator in XSLT

    This is a simple yet common use of choose operator for templates
    <xsl:choose>
      <xsl:when test="@RefersTo = 'Value'"> some normal text</xsl:when>
      <xsl:otherwise>
        <a style="text-decoration: none;">
          <xsl:attribute name="href">
            <xsl:value-of select="@myurl"/>
          </xsl:attribute>
          <span> another text in the hyperlink</span>
        </a>
      </xsl:otherwise>
    </xsl:choose>

    public by Casper  4036  0  7  3

    foreach construct in XSLT templates

    Simple example of a for each construct
    <xsl:for-each select="myXMLElem" >
      <div>
        <xsl:text disable-output-escaping="yes">&amp;raquo;&amp;nbsp;</xsl:text>
        <a style="text-decoration: none; margin-left:0.5em;">
          <xsl:attribute name="href">
            <xsl:value-of select="@myAttrInXMLElem"/>
          </xsl:attribute>
          <span><xsl:value-of select="@anotherAttr"/></span>
        </a>
      </div>
    </xsl:for-each>

    List Complete ( 4 snippets total )

    • Public Snippets
    • Channels Snippets