Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XSL e XML: Problema con gli attributi

2 views
Skip to first unread message

giandrea

unread,
Nov 24, 2008, 4:07:36 PM11/24/08
to
Salve a tutti,

ho un XML come questo

<output>
<page1>
<field id="nome">
<value>Andrea</value>
</field>
<field id="citta">
<value>
Milano
</value>
</field>
</output>

e devo generare un pdf a partire da questo XML. Ho usato questo metodo
ma non funziona come vorrei:

<xsl:template match="output/page1">
<xsl:variable name="id_" select="@id"/>
<xsl:variable name="field" select="output/page1/field[@id=$id_]" />
<fo:block font-size="10pt" color="black">
<xsl:value-of select="$id_"/>: <xsl:value-of select="."/>
</fo:block>
</xsl:template>

Purtroppo mi estrare tutti i contenuti senza stamparmi l'attributo id
del field.
avete qualche suggerimento? Vi ringrazio anticipatamente!!!!!

Andrea

giandrea

unread,
Nov 24, 2008, 4:50:58 PM11/24/08
to

risolto!


<xsl:template match="output/page1">
<xsl:apply-templates select="field"/>
</xsl:template>


<xsl:template match="field">
<fo:block font-size="10pt" color="black" font-weight="bold" text-
align="left">
<xsl:if test="@id ='data'">Data:</xsl:if>
<xsl:if test="@id ='nome'">Nome:</xsl:if>
<xsl:if test="@id ='cognome'">Cognome:</xsl:if>
<xsl:if test="@id ='luogonascita'">Luogo di Nascita:</xsl:if>
<xsl:if test="@id ='datanascita'">Data di Nascita:</xsl:if>
<xsl:if test="@id ='indirizzo'">Indirizzo:</xsl:if>
<xsl:if test="@id ='citta'">Città:</xsl:if>
<xsl:if test="@id ='quesito'">Quesito:</xsl:if>
<xsl:if test="@id ='areaanatomica'">Area anatomica:</xsl:if>
<xsl:if test="@id ='quesito'">Quesito:</xsl:if>
<xsl:if test="@id ='referto'">Referto:</xsl:if>
<xsl:if test="@id ='note'">Note:</xsl:if>
<xsl:value-of select="value" />
</fo:block>
</xsl:template>

0 new messages