<?xml version="1.0" encoding="UTF-8"?>

<xml>

    <listing>

        <listing_mlsno/>

        <listing_streetno/>

        <listing_street/>

        <listing_city>LogCity</listing_city>

        <listing_state/>

        <listing_zip/>

        <agent>

            <first_name>Sushant</first_name>

            <last_name>shah</last_name>

            <office_name>OfficeName</office_name>

            <address1>Address1</address1>

            <address2/>

            <city>City</city>

            <state>State</state>

            <zip/>

        </agent>

        <violations>

            <violation>

                <violation_num>2.4</violation_num>

                <violation_type_desc>Misuse of Public Remarks</violation_type_desc>

                <violation_mlsrule_no>MLs rule for id 2</violation_mlsrule_no>

                <violation_desc>some description for Violation ID : 2</violation_desc>

                <examples>

                    <violation_example>Example 1</violation_example>

                    <violation_example>Example 2</violation_example>

                </examples>

            </violation>

            <violation>

                <violation_num>1.3</violation_num>

                <violation_type_desc>Misuse of Agent Remarks</violation_type_desc>

                <violation_mlsrule_no>MLS rule ID 3</violation_mlsrule_no>

                <violation_desc>something with violation id 3 </violation_desc>

                <examples>

                    <violation_example>Example 3</violation_example>

                    <violation_example>Example4</violation_example>

                </examples>

            </violation>

            <violation>

                <violation_num>1.3</violation_num>

                <violation_type_desc>Misuse of Agent Remarks</violation_type_desc>

                <violation_mlsrule_no>MLS rule ID 3</violation_mlsrule_no>

                <violation_desc>something with violation id 3 </violation_desc>

                <examples>

                    <violation_example>Example 5</violation_example>

                </examples>

            </violation>

        </violations>

        <pwr_name>Pacific West Association of REALTORS</pwr_name>

        <pwr_header>All Header below the Address information</pwr_header>

        <pwr_footer>All Footer Information</pwr_footer>

        <pwr_email>[EMAIL PROTECTED]</pwr_email>

        <pwr_address>702 Town and County Rd Orange, CA 92868</pwr_address>

        <pwr_contactname>Henry Campos</pwr_contactname>

        <pwr_fax>(714) 245 - 5596</pwr_fax>

        <expire_date>11/14/05</expire_date>

        <current_date>11/09/05</current_date>

        <corrective_period>48 HOURS</corrective_period>

    </listing>

</xml>

 


From: Christine Li [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 09, 2005 10:52 AM
To: xalan-j-users@xml.apache.org
Subject: Re: XSL for-each problem

 


Hi, Daniel

I can't tell why you got wrong result without seeing your stylesheet. Post your stylesheet, I may help.

Christine Li
XSLT Development
IBM Toronto Lab
Tel: (905)413-2601
Email: [EMAIL PROTECTED]


"Kalcevich, Daniel" <[EMAIL PROTECTED]>

09/11/2005 01:12 PM

To

xalan-j-users@xml.apache.org

cc

 

Subject

XSL for-each problem

 

 

 




Everyone,
 
I am trying to transform a stylesheet and I am running into a problem with the <xsl:for-each> element.  I want to select all <violation> elements underneath the <violations> element.  There are 3 shown in the XML below.  Anyways, I am trying to use the XPath query “//listing/violations/violation” but when I do, it loops through my code 12 times!  I am trying to find the right XPath query so that it only searches 3 times.  Any help is appreciated.  Any help is appreciated!  Thanks.
 
 
//////////////////////////// XML File //////////////////////////////
 
<?xml version="1.0" encoding="UTF-8"?>
<xml>
    <listing>
        <violations>
            <violation>
                <violation_num>2.4</violation_num>
                <violation_type_desc>Misuse of Public Remarks</violation_type_desc>
                <violation_mlsrule_no>MLs rule for id 2</violation_mlsrule_no>
                <violation_desc>some description for Violation ID : 2</violation_desc>
                <examples>
                    <violation_example>Example 1</violation_example>
                    <violation_example>Example 2</violation_example>
                </examples>
            </violation>
            <violation>
                <violation_num>1.3</violation_num>
                <violation_type_desc>Misuse of Agent Remarks</violation_type_desc>
                <violation_mlsrule_no>MLS rule ID 3</violation_mlsrule_no>
                <violation_desc>something with violation id 3 </violation_desc>
                <examples>
                    <violation_example>Example 3</violation_example>
                    <violation_example>Example4</violation_example>
                </examples>
            </violation>
            <violation>
                <violation_num>1.3</violation_num>
                <violation_type_desc>Misuse of Agent Remarks</violation_type_desc>
                <violation_mlsrule_no>MLS rule ID 3</violation_mlsrule_no>
                <violation_desc>something with violation id 3 </violation_desc>
                <examples>
                    <violation_example>Example 5</violation_example>
                </examples>
            </violation>
        </violations>
    </listing>
</xml>
 
 
//////////////////// XSL
 
<xsl:for-each select=”//listing/violations/violation”>
      <xsl:value-of selec=”violation_num”/>
</xsl:for-each>
 
Daniel Kalcevich
Software Engineer
SCJP,SCWCD
ext. 7503
 

Attachment: notification_html.xsl
Description: notification_html.xsl

Reply via email to