PDA

View Full Version : i need xml/xslt help, plz



Sheepdog
August 24th 2003, 03:36 PM
ok, lets say i have a section of xml that goes like this:



<link>
http://www.pinkfuzzybunnies.us
</link>
<atext>
(Click here to visit the Pink Fuzzy Bunnies unofficial website.)
</atext>


is there a way to make something like the above into xhtml like this...



<a href="http://www.pinkfuzzybunnies.us" target="_new">
(Click here to visit the Pink Fuzzy Bunnies unofficial website.)
</a>


...through an xslt file? what would be the best way to do this?

and no doubt will need more than one link to a page, but one thing at a time.

Sheepdog
August 25th 2003, 02:43 AM
Cansel that. i found out how. first, i write it like this in the XML file:



<exlink>
<url>
http://www.pinkfuzzybunnies.us
</url>
<text>
(Click here to visit the Pink Fuzzy Bunnies unofficial website.)
</text>
</exlink>


then this would be the template in XSLT:



<xsl:template match="exlink">
<a>
<xsl:attribute name="href">
<xsl:value-of select="url"/>
</xsl:attribute>
<xsl:value-of select="text"/>
</a>
</xsl:template>


heh, you all can learn along with me :poke:

AcousticJS
August 27th 2003, 07:51 AM
heh, you all can learn along with me

Actually, that does solve a problem I was having. Thanks a lot!

God bless
Jon

Sheepdog
August 28th 2003, 01:02 AM
no problem. so far, the best "tutorial" i have found on XSLT is here:
http://www.ibiblio.org/xml/books/bible2/chapters/ch17.html

very good for reference.