?
Solved

XSL Help

Posted on 2004-11-17
6
Medium Priority
?
334 Views
Last Modified: 2008-03-10
whats wrong with the following?

 <table name="mortgagearrears">
          <xsl:if test="../cblmlon0/arr-missed/item[@index <= 3]/@data != 0">
            <row count="1" indexID="">
              <column name="lastUpdated"/>
              <column name="avcID">{AVCID}</column>
              <column name="payments">
                <xsl:value-of select="sum(../cblmlon0/arr-missed/item[@index <= 3]/@data)"/>
              </column>
              <column name="months">12</column>
              <column name="total"/>
              <!-- JHC MOD <column name="date_issued"/> -->
              <column name="date_satisfied"/>
              <!-- JHC MOD <column name="monthly_payment"/> -->
              <column name="monthsSatisfied"/>
            </row>
          </xsl:if>
          <xsl:if test="sum(../cblmlon0/arr-missed/item[@index = 4]/@data) != 0">
            <row indexID="">
              <xsl:attribute name="count">
                <xsl:if test="../cblmlon0/arr-missed/item[@index <= 3]/@data = 0">1</xsl:if>
                <xsl:if test="../cblmlon0/arr-missed/item[@index <= 3]/@data != 0">2</xsl:if>
              </xsl:attribute>
              <column name="lastUpdated"/>
              <column name="avcID">{AVCID}</column>
              <column name="payments">
                <xsl:value-of select="format-number(../cblmlon0/arr-missed/item[@index = 4]/@data,'0')"/>
              </column>
              <column name="months">36</column>
              <column name="total"/>
              <!-- JHC MOD <column name="date_issued"/> -->
              <column name="date_satisfied"/>
              <!-- JHC MOD <column name="monthly_payment"/> -->
              <column name="monthsSatisfied"/>
            </row>
          </xsl:if>
        </table>

The error is "Unescaped '<' not allowed in attributes values" so I guess my question is how the heck do I escape this?
0
Comment
Question by:paranoidcookie
  • 3
  • 2
6 Comments
 
LVL 15

Accepted Solution

by:
dualsoul earned 1000 total points
ID: 12603089
"<" this symbol is invalid in XML documents (XSLT - is xml you know), you should use &lt; entity instead of.

Here is the correct evrsino of your snippet:

      <table name="mortgagearrears">
          <xsl:if test="../cblmlon0/arr-missed/item[@index &lt; = 3]/@data != 0">
            <row count="1" indexID="">
              <column name="lastUpdated"/>
              <column name="avcID">{AVCID}</column>
              <column name="payments">
                <xsl:value-of select="sum(../cblmlon0/arr-missed/item[@index &lt;= 3]/@data)"/>
              </column>
              <column name="months">12</column>
              <column name="total"/>
              <!-- JHC MOD <column name="date_issued"/> -->
              <column name="date_satisfied"/>
              <!-- JHC MOD <column name="monthly_payment"/> -->
              <column name="monthsSatisfied"/>
            </row>
          </xsl:if>
          <xsl:if test="sum(../cblmlon0/arr-missed/item[@index = 4]/@data) != 0">
            <row indexID="">
              <xsl:attribute name="count">
                <xsl:if test="../cblmlon0/arr-missed/item[@index &lt;= 3]/@data = 0">1</xsl:if>
                <xsl:if test="../cblmlon0/arr-missed/item[@index &lt;= 3]/@data != 0">2</xsl:if>
              </xsl:attribute>
              <column name="lastUpdated"/>
              <column name="avcID">{AVCID}</column>
              <column name="payments">
                <xsl:value-of select="format-number(../cblmlon0/arr-missed/item[@index = 4]/@data,'0')"/>
              </column>
              <column name="months">36</column>
              <column name="total"/>
              <!-- JHC MOD <column name="date_issued"/> -->
              <column name="date_satisfied"/>
              <!-- JHC MOD <column name="monthly_payment"/> -->
              <column name="monthsSatisfied"/>
            </row>
          </xsl:if>
        </table>
0
 
LVL 5

Author Comment

by:paranoidcookie
ID: 12603281
OK got a bit further but now I get a whole load of errors like the following?

XPath error Invalid expression../cblmlon0/arr-missed/item[@index < = 3]/@data != 0                          
                                     ^
XPath error Invalid expression
../cblmlon0/arr-missed/item[@index < = 3]/@data != 0
                                     ^
compilation error: file xslt/ccs.xsl line 1590 element if
xsl:if : could not compile test expression '../cblmlon0/arr-missed/item[@index < = 3]/@data != 0'
XPath error Invalid expression
sum(../cblmlon0/arr-missed/item[@index < = 3]/@data)
0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12603746
you now inserted additonal white space:
you are using "&lt; <" it should be "&lt;<"
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Author Comment

by:paranoidcookie
ID: 12603813
Hold on a sec is the correct syntax

&lt;as suggested by dualsoul

or

&lt;< from ramazanyich?
0
 
LVL 19

Assisted Solution

by:ramazanyich
ramazanyich earned 1000 total points
ID: 12603824
sorry:
it should be &lt;=
0
 
LVL 5

Author Comment

by:paranoidcookie
ID: 12603891
Thanks guys
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question