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

RE: XSL questions

Subject: RE: XSL questions
From: "Wei Wei" <wei725@xxxxxxxxx>
Date: Thu, 01 Jun 2006 09:05:00 -0800
for each tag in xsl
Thanks all for your information.

I might not make my questions clear. Please see the below.

>
> There are others far more qualified than I, but perhaps this will help you
> get started.
>
> 1) HTML are valid xml tags so I don't know why you cannot have them inside
> an xml document.  The following should be possible:
>
> <myxmltag>
> 	<html>
> 		<body></body>
> 	</html>
> </myxmltag>
>
> I don't understand what you mean by a "par field", so perhaps this has
> something to do with your problem.  Perhaps if you show the xml and xsl we
> could be of more help.
>

I have a element definited in a DTD file as

<!ELEMENT Para (#PCDATA | Emphasis)*>

I need to the content of the element contains the html list tags, eg.
<ul><LI>first</LI><LI>second</LI></ul>.

XMLSpy says that is invalid since the parent elements' content disallow
element ul.

> 2) XSLT does not have a variable that can be incremented (as far as I know)
> within a loop.  Variables in XSLT are more like constants, so once set,
> their value cannot be changed.   I think you will have to get your count
> like "count(nodetest)" outside of a loop which should not be a problem
since
> if you can select the nodes and loop through them, count should also work
> for the same node set.
>

The position function doesn't work for my need. It returns the total number of
elements.

I have tried to use the count on an element/attribute. I don't know why it
always returns one. Here is the code segment:

				<xsl:for-each select="BaseballInfo/TeamList/Team">
						<xsl:sort select="GameRecord/@points" order="descending"/>
						<xsl:if test="@region = 'south'">
							<xsl:choose>
								<xsl:when test="count(@id) mod 2 > 0">
	<xsl:value-of select="count(@id)"/>
								</xsl:when>
								<xsl:otherwise>

					<xsl:value-of select="count(@id)"/>
				</xsl:otherwise>
							</xsl:choose>
						</xsl:if>
					</xsl:for-each>

> 3) I'm not exactly sure what you mean here, but if you enter the
> xsl:for-each loop, then the condition has been met.  What else do you need
> to know about the condition?
>

Here is the code segment:

				<xsl:for-each select=" ...">
					<xsl:if test="$current_id = @relatedPerson">

					</xsl:if>
				</xsl:for-each>

After this loop, I need to know whether there is an element met the condition
or not, that is a condition check right after the loop.

I am not sure how to use the [condition] in this case.


Thanks again for all your helps.

w.

> -----Original Message-----
> From: Wei Wei [mailto:wei725@xxxxxxxxx]
> Sent: Thursday, June 01, 2006 9:41 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  XSL questions
>
>
> I am very new to XSL. Here are my XSL questions.
>
>
> 1) how to embed html tags in a XML which will be processed by XSL?
>
> The XMLSpy doesn't let me add html tags into a par field. I let the CDATA
> hold the tags, but the section data won't get parsed.
>
> 2) Counter inside of xsl:for-each
>
> With the xsl:choose tag inside of xsl:for-each tag, I need to count the
> number of nodes met the condition. How to set up the counter?
>
> 3) Flag inside of xsl:for-each
>
> With the xsl:if tag inside of xsl:for-each tag, I need to know whether a
> node met the condition by the end of the loop. How to set up the flag
> variable?
>
> Thanks for any information in advance.
>
> wei
>
>
>
> --
> _______________________________________________
>
> Search for businesses by name, location, or phone number.  -Lycos Yellow
> Pages
>
>
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp
> ?SRC=lycos10

>


--
_______________________________________________

Search for businesses by name, location, or phone number.  -Lycos Yellow
Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?
SRC=lycos10

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-2007 All Rights Reserved.