homepage Welcome to WebmasterWorld Guest from 54.205.144.54
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Pull url out of returned value
andrewsmd




msg:4345169
 8:33 pm on Jul 28, 2011 (gmt 0)

I have a prebuilt system so I can't change the back end.
When I call <xsl:value-of select="udt:Application" disable-output-escaping="yes" />

I get html like
<a href="someplace/somefile.pdf">somefile.pdf</a>

What I want to be able to do is make the link just say application, no matter what the file name is. This is the html I would like
<a href="someplace/somefile.pdf">Application</a>
I really have no idea about how to do this because I'm somewhat a noob with xsl. Examples are welcome, but if someone can just give me the names of things I would need to use I can probably google them and get it. Thanks in advance!

 

httpwebwitch




msg:4346687
 2:28 pm on Aug 2, 2011 (gmt 0)

hmm. instead of <xsl:value-of>, write a template that matches the input <a> node, outputs a new one with @href matching the @href of the input, with <xsl:text>Application</xsl:text> inside the <a>

you'll need:

<xsl:apply-templates>
<xsl:value-of>

andrewsmd




msg:4346693
 2:45 pm on Aug 2, 2011 (gmt 0)

I'm not for sure I understand what you mean?

httpwebwitch




msg:4347294
 5:59 pm on Aug 3, 2011 (gmt 0)

Sorry about that. XSLT is hard to talk about in English sometimes.

I mean, if you have an XML node with a structure like:
<a href="someplace/somefile.pdf">somefile.pdf</a>


then you can use an XSLT "template" to turn it into:
<a href="someplace/somefile.pdf">Application</a>


the node "udt:Application" contains HTML, but it happens that HTML is valid XML and can be further transformed by - instead of outputting the <xsl:value-of> - sending it to a template that changes it into something else.

Some rules defined in a <xsl:template> will accept input sent to it by <xsl:apply-templates>.

example:
[w3schools.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved