transformation xml via xslt
bonjour a tous
j'ai un fichier xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?iview mediapro exportversion="1.0.0.a1" appversion="2.6" ?>
<CatalogType>
<Catalog>exemple</Catalog>
<MediaItemList>
<MediaItem>
<AnnotationFields>
<Filename>aaa</Filename>
<EventDate>bbb</EventDate>
<City>ccc</City>
<Copyright>ddd</Copyright>
<Caption>eee</Caption>
</AnnotationFields>
</MediaItem>
</MediaItemList>
</CatalogType> |
et avec le xslt suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='html' version='1.0' encoding='utf-8' indent='no'/>
<xsl:template match="/">
<structure>
<xsl:apply-templates/>
</structure>
</xsl:template >
<xsl:template match="AnnotationFields" >
<image> image="<xsl:value-of select="Filename"/>_img.png" thumb="<xsl:value-of select="Filename"/>_tmb.png" print="false" info1="<xsl:value-of select="Filename"/>" info2="<xsl:value-of select="City"/>" info3="<xsl:value-of select="EventDate"/>" info4="<xsl:value-of select="Copyright"/>" info5="<xsl:value-of select="Caption"/>"
</image>
</xsl:template >
</xsl:stylesheet> |
j'obtiens :
Code:
1 2 3 4 5 6 7 8
| <structure>
exemple
<image> image="aaa_img.png" thumb="aaa_tmb.png" print="false" info1="aaa" info2="bbb" info3="ccc" info4="ddd" info5="eee"
</image>
</structure> |
est-il possible d'obtenir un code final du type :
Code:
1 2 3
| <structure>
<image image="aaa_img.png" thumb="aaa_tmb.png" print="false" info1="aaa" info2="bbb" info3="ccc" info4="ddd" info5="eee"/>
</structure> |
merci