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 |
- XSL for-each problem Kalcevich, Daniel
- Re: XSL for-each problem Christine Li
- RE: XSL for-each problem Kalcevich, Daniel
- RE: XSL for-each problem Christine Li
- RE: XSL for-each problem Kalcevich, Daniel
- RE: XSL for-each problem Steve Carton
- RE: XSL for-each problem Christine Li