[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem with Xpath

Subject: Problem with Xpath
From: ms <mina_hurray@xxxxxxxxx>
Date: Wed, 13 Dec 2006 10:39:01 -0800 (PST)
 Problem with Xpath
Hi all:

I am having issues with Xpath. 

My xml looks like this:

<root>

<l1>
			<text>
				<para>First level</para>
			</text>
			<info>
				<comp>Kmart</comp>
				<prod>Shoes</prod>
			</info>
			<l2>
			<text>
				<para>Second level .</para>
			</text>
			</l2>
		</l1>
		<l1>
			<text>
				<para>Second level</para>
				<info>
				<comp>Kmart</comp>
				<prod>Shoes</prod>
			</info>
			</text>
		</l1>
			<l1>
			<text>
				<para>Third level</para>
				<info>
				<comp>Target</comp>
				<prod>Pen</prod>
			</info>
			</text>
		</l1>
</root>

Now, I have logic in my style sheet which says that
only if element <l1> contains element <info>, then
if <comp> and <prod> values match the values being
passed to the style sheet through two other parameters
<company> and <product> , then display l1 , otherwise
do not display l1.

The XSLT is :


<xsl:template match="l1">
<xsl:choose>
			<xsl:when test="//info">
				<xsl:if test="//info/company=$company and
//info/product=$product">
					<fo:list-block>
						<fo:list-item>
							<fo:list-item-label>
								<fo:block>
									<xsl:number format="1"/>
								</fo:block>
							</fo:list-item-label>
							<fo:list-item-body>
								<fo:block>
									<xsl:apply-templates/>
								</fo:block>
							</fo:list-item-body>
						</fo:list-item>
					</fo:list-block>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
			<!-- Do something else-->
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

So, if I have passed $company="KMart" and
$product="Shoes" on the style sheet, then the expected
output is:

1 First
2 Second

Instead, it matches only the company and product for
the first level and stops there. Can you please tell
me what is wrong with the xpath to company and product
on the style sheet?

Thank you in advance for your help. 




 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.