Search code examples
xsltcoldfusionxhtmlmarkupnested

ready.mobi mobile readiness nesting xsl tags appropriately?


I've been trying to change my code for a while now and have failed to do so.

I am able to get the readiness score to peak at 3.72 and have the code display and function well here: link removed

But when used with ready.mobi: ready.mobi/launch.jsp?locale=en_EN#fragment-1

I get the following errors:

    FAIL near line -1 column -1
    Your page does not validate against XHTML Basic 1.1 or XHTML Mobile Profile 1.2

    FAIL near line 41 column 17
    The content of element type "a" must match "(br|span|em|strong|dfn|code|samp|kbd|var|cite|abbr|acronym|q|tt|i|b|big|small|sub|sup|img|object|input|select|textarea|label|button|script|noscript)".

    FAIL near line 46 column 17
    *same element type "a" error line

    FAIL near line 51 column 17
    *same element type "a" error line

    FAIL near line 56 column 17
    .....

    FAIL near line 61 column 17
    ...

Because of the markup errors, the xhtml mobile profile fails as well.

But having said that, my score can be a 5 with both xhtml mobile profile and markup valid if the code is like the following: link removed

The nesting order is changed for the validator to accept. However, this causes the links to be broken.

Before:

    <xsl:element name="a">
    <xsl:attribute name="href">
        <xsl:value-of select="link"/>
    </xsl:attribute>
</xsl:element>
    <xsl:element name="p"><xsl:attribute name="class"><xsl:text>more</xsl:text></xsl:attribute><xsl:text>more...</xsl:text></xsl:element>

After:

    <xsl:element name="a">
    <xsl:attribute name="href">
        <xsl:value-of select="link"/>
    </xsl:attribute>
    <xsl:element name="p"><xsl:attribute name="class"><xsl:text>more</xsl:text></xsl:attribute><xsl:text>more...</xsl:text></xsl:element>
</xsl:element>

Any help will be appreciated. :) Many thanks!!!


Solution

  • What about if you put the <a> inside the <p>?

    <xsl:element name="p"><xsl:attribute name="class"><xsl:text>more</xsl:text></xsl:attribute>
     <xsl:element name="a">
        <xsl:attribute name="href">
            <xsl:value-of select="link"/>
        </xsl:attribute>
        <xsl:text>more...</xsl:text></xsl:element>
    </xsl:element>
    

    or much more simply, using literal result elements and an attribute value template for the href:

    <p class="more"><a href="{link}">more...</a></p>