View Single Post
  #1 (permalink)  
Old September 21st, 2009, 05:10 AM
sacha74 sacha74 is offline
Registered User
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default [XSLT] Group tags to prioritize the xml file

Hello,

I have 2 problems with an xml file:

1. the original xml has no structure because all the tags (except the root element) are at the same level. What I want to do is to insert a tag <toto>, whose children would be one <FM1Titre> and all the tags that follow it until the next tag <FM1Titre>.

2. I would like to report the content of the tag FM1Titre as the name of the tag that I have mentionned above.

Here is a part of the xml file:

<XML>
<FM1Titre>Description </FM1Titre>
<Bloc-paragraphe>La table mère permet de paramétrer les tables. </Bloc-paragraphe>
<Bloc-paragraphe>Toute nouvelle table doit être créée en premier lieu dans la table mère.</Bloc-paragraphe>

<FM1Titre>Détails techniques </FM1Titre>
...</XML>

What I would like to obtain after transformation :

<XML>
<Description>
<FM1Titre>Description </FM1Titre>
<Bloc-paragraphe>La table mère permet de paramétrer les tables. </Bloc-paragraphe>
<Bloc-paragraphe>Toute nouvelle table doit être créée en premier lieu dans la table mère.</Bloc-paragraphe>
</Description>

<Détails techniques>
<FM1Titre>Détails techniques </FM1Titre>
</Détails techniques>

...</XML>
My researches have been unsuccessful (research on the net, on proposed solutions on the forum) and I begin to think that it is maybe impossible to do that with XSLT 1.0.
I use to find a solution to problem of that kind but this time I do not manage to find an answer by myself, so if anyone could have a solution or a track, please help me...

Thanks in advance.
Reply With Quote