Search

The following code parses the data entered into the CMS

<xsl:if test="data/collection-items/entry/text!=''"> <div id="collection-detail-text"> <xsl:apply-templates select="data/collection-items/entry/text"/> </div> </xsl:if>

But when I created a new Embed field for the same blueprint and used the following code it will NOT parse the data entered into the CMS

<xsl:if test="data/collection-items/entry/embed!=''"> <xsl:apply-templates select="data/collection-items/entry/embed"/> </xsl:if>

or

<xsl:if test="data/collection-items/entry/embed-code!=''"> <xsl:apply-templates select="data/collection-items/entry/embed-code"/> </xsl:if>

does not work.

below is the entire xsl file:

 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../utilities/master.xsl"/>   <xsl:import href="../utilities/use-media.xsl"/>   <xsl:template match="data">   </xsl:template>    
      <xsl:template name="content-left">
        <table width="100%" border="0" cellspacing="15" cellpadding="0">
          <tr>
            <td width="755" height="500" valign="top" class="content-page-block">
              <div id="collection-detail-flash" style="height:460px">
                <xsl:call-template name="flash-embed">
                  <xsl:with-param name="flash" select="data/collection-items/entry/detail-flash"/>
                  <xsl:with-param name="width" select="745"/>
                  <xsl:with-param name="height" select="450"/>
                </xsl:call-template>
              </div>
              <!--<img src="{$workspace}/images/lijn.png"/>-->
              <xsl:if test="data/collection-items/entry/text!=''">
                <div id="collection-detail-text">
                  <xsl:apply-templates select="data/collection-items/entry/text"/>
                </div>
              </xsl:if>

              <br/>
              <br/>
              <a href="{$root}/{$root-page}" class="cufon-alexandria">BACK TO COLLECTION</a>
            </td>
          </tr>
        </table>   </xsl:template>

    </xsl:stylesheet>

would you mind posting your <xsl:template name="flash-embed">

sure, here you go..

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template name="flash-embed">
        <xsl:param name="flash"/>
        <xsl:param name="width">
            100&#37;
        </xsl:param>
        <xsl:param name="height">
            100&#37;
        </xsl:param>
        <xsl:param name="class"/>
        <xsl:param name="clicktag"/>

        <xsl:variable name="flash-url">
            <xsl:value-of select="$workspace"/>
            <xsl:value-of select="$flash/@path"/>
            <xsl:text>/</xsl:text>
            <xsl:value-of select="$flash/filename"/>
        </xsl:variable>

        <div class="nox-flash" style="width:{$width}px;height:{$height}px;visibility:hidden" title="{$clicktag}">
            <xsl:value-of select="$flash-url"/>
        </div>

        <!-- ?cachekiller={$today}-{$current-time} -->

        <!--<object id="nox-flash" height="{$height}" width="{$width}" type="application/x-shockwave-flash" name="nox-flash" data="{$flash-url}">
            <param name="menu" value="false"/>
            <param name="wmode" value="transparent"/>
            <param name="movie" value="{$flash-url}"/>
            <PARAM NAME="flashvars" VALUE="workspace={$workspace}&#38;clickTag={$clicktag}"/>
            <embed flashvars="workspace={$workspace}" width="{$height}" height="{$width}" src="{$flash-url}" name="nox-flash" wmode="transparent" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>
        </object>-->

    </xsl:template>

</xsl:stylesheet>

let me know if you need anything else.. i’m pretty desperate for a resolution.. i can make donations whatever, etc..

I see quite a few problems with your template but without seeing all of the XSLT code, including your XML source, I cannot be sure. Here’s a list of oddities that I’ve found:

Q1. Why do you have a template that is matching the data element but it’s empty? This might not be a problem, depending on the other XSLT files you are importing but it’s worth noting.

Q2. You have an apply-templates, that’s applying to data/collection-items/entry/text but I don’t see a matching template for it.

In XSLT, if you don’t have a matched template that you are applying, it will try to spit the literal data value out to HTML. Since data/collection-items/entry/text is likely just text, it is outputting the text values. For the other two templates you are trying to apply, they most likely do not contain text but XML elements with attributes.

The rule is, for every template you are trying to apply, you need a matching template counter-part. If you just want to grab values, use <xsl:value-of select="data/collection-items/entry/text"/> instead.

Q3. You are importing master.xsl and use-media.xsl. We need to see what’s in those to be able to get a full picture.

When submitting XML/XSLT questions, it is best to use a public code past-board service like http://pastie.org/ to post all your relevant code. This includes all your relevant XSLT files (including anything you’re importing) and your XML source.

By the way, the site you’re building looks very good :)

okay, so now i have the entry made into the CMS parsing onto the website

there was nothing wrong with the XSL code.

<xsl:value-of select="data/collection-items/entry/embed"/> 

I had to enter a variable ‘embed’ to the array in the php code for data.collection_items.php

    public $dsParamINCLUDEDELEMENTS = array(
            'title',
            'text: formatted',
            'intro-image',
            'intro-flash',
            'detail-flash',
            'embed'
    );

Now my problem lies in the XSL stripping out the tags. I need to parse HTML more specifically an IFRAME. I was thinking of formatting the stylesheet in a way where it would just pass through the IFRAME src value and have the rest hard coded into the style sheet.. Any suggestions?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details