This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problems with transforming xml with xsl! sample inside


on a validated XML (with DTD):

<xsl:template match="paragraph">
     <xsl:apply-templates/>
</xsl:template>

<xsl:template match="linkRef">
     <a href="id(@id)/@value"><xsl:value-of select="id(@id)/@name"/></a>
</xsl:template>

with keys:

<xsl:key name="links" match="link" use="@id"/>

     <a href="key('links',@id)/@value"><xsl:value-of 
select="key('links',@id)/@name"/></a>

"pure XPATH":

     <a href="/doc/links/link[@id=current()/@id]/@value"><xsl:value-of 
select="/doc/links/link[@id=current()/@id]/@name"/></a>

Regards,

Joerg

Jan Krattiger wrote:
> i have the following xml:
> 
> <doc>
>     <links>
>       <link id="lr1" name="xyz" value="xyz.com" />
>       <link id="lr2" name="abc" value="abc.com" />
>     </links>
>     <paragraphs>
>       <paragraph title="foo">
>       some text here, some text here <linkRef id="lr1"/> another text,
> another text <linkRef id="lr2"/> and even more text.
>       </paragraph>
>     </paragraphs>
> </doc>
> 
> the result should look like this:
> 
> foo
> some text here, some text here xyz.com another text, another text abc.com
> and even more text.
> 
> 
> the goal is to transform this xml with a xsl. now the problem is, that i'm
> not able to replace the <linkRef> with the specfied link. i tried to do it
> within xsl and tried to do it with dom in asp. i don't know how i can
> realize that. anyone knows a solution? thanks for any help.
> i heard something about transorming it twice.. but i dunno how to do it. 
> 
> J.M.K
> 
> Software Developer
> 
> Unit.Net AG
> Thurgauerstrasse 54
> CH - 8050 Zurich
> 
> Email:   jan.krattiger@unit.net       
> Web:     http://unit.net


-- 

System Development
VIRBUS AG
Fon  +49(0)341-979-7411
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]