[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [Wtp-wst-dev] Question for XML parsing
|
This list is for development discussions
focused on the WTP Web standard tools. For general XSLT questions you should
consult a XSLT support list. As a start, you may find the information you
need at the W3C [1].
[1] http://www.w3.org/Style/XSL/
Lawrence Mandel
Software Developer
IBM Rational Software
Phone: 905 - 413 - 3814 Fax: 905 - 413 - 4920
lmandel@xxxxxxxxxx
"Guo Chen" <jardonc@xxxxxxxxxx>
Sent by: wtp-wst-dev-bounces@xxxxxxxxxxx
05/29/2006 10:32 PM
Please respond to
"Web Standard Tools developer discussions." <wtp-wst-dev@xxxxxxxxxxx> |
|
To
| "Web Standard Tools developer discussions."
<wtp-wst-dev@xxxxxxxxxxx>
|
cc
|
|
Subject
| RE: [Wtp-wst-dev] Question for XML parsing |
|
Hi
Thank you for the response.
I). I tried to use some params
to hold reference:
<xsl:template name="prodAndRel">
<xsl:param name="prod1"/>
<xsl:param name="prod2"/>
<xsl:param name="rel1"/>
<xsl:param name="rel2"/>
<xsl:choose>
<xsl:when test="position()=1"> <!--First
pro_rel element comes in-->
<xsl:param name="prod1" select="./@name"/>
<xsl:param name="rel1" select="./@end_rel"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test=./@name
!= $prod1> <!--if this is not ABC, then must be XYZ-->
<xsl:param name="prod2" select="./@name"/>
<xsl:param name="rel2" select="./@end_rel"/>
</xsl:if>
<xsl:if test="./@name
= $prod1 and ./@end_rel
> $rel1"><xsl:param name="rel1" select="./@end_rel"/></xsl:if><!--ABC
repeats, update the max_rel-->
<xsl:if test="./@name
= $prod2 and ./@end_rel
> $rel2"><xsl:param name="rel2" select="./@end_rel"/></xsl:if>><!--XYZ
repeats, update the max_rel-->
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$prod1 !='' and $prod2 !='' and $prod1 != $prod2">
<xsl:if test="$rel1 < 3.0 and $rel2 < 3.0">
<xsl:call-template name="removeAll"/>
</xsl:if>
<xsl:if test="$rel1 > 3.0">
<xsl:call-template name="oneProd">
<xsl:with-param name="prod1" select="$prod1"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$rel2 > 3.0">
<xsl:call-template name="oneProd">
<xsl:with-param name="prod2" select="$prod2"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
But it still doesn't work, I don't
know why.
2).Yes, I'm using Xerces. The problem
is if I knew that ABC != XYZ and both bb and dd are less than 3.0, I already
inside <tl1_message> element, How can I skip it. Would you
please explain more detail. Or how can I removing the element after I creat
it.
Thanks
Guo
--Original Message-----
From: wtp-wst-dev-bounces@xxxxxxxxxxx [mailto:wtp-wst-dev-bounces@xxxxxxxxxxx]
On Behalf Of Lawrence Mandel
Sent: May 29, 2006 10:46 AM
To: Web Standard Tools developer discussions.
Subject: Re: [Wtp-wst-dev] Question for XML parsing
1) Depending on how the document is parsed or if you're simply passed a
model you may need to store the attribute values for comparison or simply
retrieve them from the existing model.
2) This depends on the library you're using to parse the document (are
you using JAXP? Xerces?) and can be done by skipping the element during
parse time or by removing the element from the model after the model has
been created.
Lawrence Mandel
Software Developer
IBM Rational Software
Phone: 905 - 413 - 3814 Fax: 905 - 413 - 4920
lmandel@xxxxxxxxxx
"Guo Chen" <jardonc@xxxxxxxxxx>
Sent by: wtp-wst-dev-bounces@xxxxxxxxxxx
05/29/2006 09:17 AM
Please respond to
"Web Standard Tools developer discussions." <wtp-wst-dev@xxxxxxxxxxx> |
|
To
| "Web Standard Tools developer
discussions." <wtp-wst-dev@xxxxxxxxxxx>
|
cc
| <wtp-wst-dev-bounces@xxxxxxxxxxx>
|
Subject
| [Wtp-wst-dev] Question for XML parsing |
|
Hi,
I'm parsing an XML file, there is an element named <tl1_message>
inside this file, it looks like:
<tl1_message>
<tl1_message_type>
..
..
..
</tl1_message_type>
<prod_rel name="ABC" start_rel="aa" end_rel="bb"/>
<prod_rel name="XYZ" start_rel="cc" end_rel="dd"/>
<other elements.../>
</tl1_message>
This is my requirements:
1). if ABC = XYZ and either bb or dd greater than 6.0, then
<tl1_message>
<tl1_message_type>
..
..
..
</tl1_message_type>
<prod_rel name="ABC"/>
<other elements.../>
</tl1_message>
2). if ABC != XYZ and both bb and dd are less than 3.0, then
the entire element <tl1_message> should be removed.
My difficulty is:
1). How to compare bb and dd, they are in different element(in the same
level).
2). How to delete the entire element in this case.
Thanks
Guo_______________________________________________
wtp-wst-dev mailing list
wtp-wst-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-wst-dev
_______________________________________________
wtp-wst-dev mailing list
wtp-wst-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-wst-dev