Topic: xslt help (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=24942" title="Pages that link to Topic: xslt help (Page 1 of 1)" rel="nofollow" >Topic: xslt help <span class="small">(Page 1 of 1)</span>\

 
jameskoeq
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Feb 2005

posted posted 02-06-2005 16:53

Can anyone help? Thanks in advance.

I have the xml document like:

<response>
<all>
<data>12345A</data>
<data>22345B</data>
<data>32345A</data>
<data>42345B</data>
<data>52345B</data>
<data>62345A</data>
<data>72345A</data>
<all>
</response>

And like to transform it to another xml document. Start with the <group> folowing with <amount> when the last character of context of the <data> is A; otherwise add the <amount> with the context when the last character of the context of the <data> is "B".

<response>
<group>
<amount>12345A</amount>
<amount>22345B</amount>
</group>
<group>
<amount>32345A</amount>
<amount>42345B</amount>
<amount>52345B</amount>
</group>
<group>
<amount>62345A</amount>
<amount>72345B</amount>
</group>
</response>

Shifter
Paranoid (IV) Inmate

From: Mesquite, TX 75149
Insane since: Aug 2000

posted posted 02-06-2005 16:58

I wish I could help ya. I don't know anything about XML..I just know that this place has become fairly useless..most people won't help and when they actually reply it's rude and snyde remarks..

Good luck friend =D

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 02-06-2005 17:52

hello jameskoeq,
welcome to the Asylum.
Please make sure to have a deep look at our ->faq - many of the traditions of this place (and lot's of technical information) is contained there.

Don't be put of by that negative vibes guy up there - Shifter, you have received competent help in most of the last threads you started. I know, I checked. If you don't like this place, go somewhere else.

I must admit my knowledge about XLST is pretty minimal, but I always believed it could not make decisions bound on the content within tags.
Does your solution need to be XLST? Or would something else, PHP, Python, etc. do as well?

so long,

->Tyberius Prime

Veneficuz
Paranoid (IV) Inmate

From: A graveyard of dreams
Insane since: Mar 2001

posted posted 02-07-2005 02:11

It is possible to do what you need (and much more ) using XSLT, not exactly sure how though

I think you'll find some answers if you search around for information about the 'contains' function which if used to check whenever a string contains something another string.

Don't have time right now to sit down and figure it out myself, but I think something based the following might work:

code:
<xsl:for-each select="//data">
<xsl:if test="contains(data, 'A')">
<!-- check for next element where contains('A') == true and create a group around that -->
</xsl:if>
</xsl:for-each>



_________________________
"There are 10 kinds of people; those who know binary, those who don't and those who start counting at zero"
- the Golden Ratio - Vim Tutorial -

Shifter
Paranoid (IV) Inmate

From: Mesquite, TX 75149
Insane since: Aug 2000

posted posted 02-07-2005 03:44
quote:
Tyberius Prime said:

hello jameskoeq,
welcome to the Asylum.
Please make sure to have a deep look at our ->faq - many of the traditions of this place (and lot's of technical information) is contained there.

Don't be put of by that negative vibes guy up there - Shifter, you have
received competent help in most of the last threads you started. I
know, I checked. If you don't like this place, go somewhere else.

I must admit my knowledge about XLST is pretty minimal, but I always
believed it could not make decisions bound on the content within tags.
Does your solution need to be XLST? Or would something else, PHP, Python, etc. do as well?

so long,

-&gt;Tyberius Prime




See, that's exactly what I'm talking about =D

Face the facts though, this place has gone way down hill. I wasn't referring to EVERYONE. Yeah there are still a few nice people around who try to help, and yes DL-44 has tried to help me several times. The last message you mentioned he failed, I had another member here who no longer posts (much) help me..and we got it working..

Anyways.. *shrug*



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu