Re: [xsl] Dumb HTML <A> question

Subject: Re: [xsl] Dumb HTML <A> question
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 3 Jan 2001 16:27:35 -0700 (MST)
Jack A. Zucker wrote:
> I'm dynamically generating links in html from my xsl processing using the
> following code:
> <xsl:template match="HelpFile">
>   <xsl:element name="A">
>     <xsl:attribute name = "href" ><xsl:value-of select="."
> /></xsl:attribute>Help
>   </xsl:element>
> </xsl:template>
> This works fine but seems to be a bit terse. Is there a simpler way to do
> this other than building the <A> and @href nodes programmatically?

I think you're confused about what "terse" means :)
What you have is verbose. You want something terse, like this:

<xsl:template match="HelpFile">
  <A href="{.}">Help</A>

There are times when verbose syntax is more desirable, such as:

  - when the attribute itself, not just its value, is optional
  - when trying to avoid having namespace nodes copied to the result tree

It's funny that you asked this question, because most people learn the
terse syntax and have to be taught the longhand.

> The other issue is not really related to xml/xsl but is a html help issue.
> My actual link is to a .chm file which is registered to point to hh.exe (the
> microsoft html help executable). The link works fine but I want to be able
> to specify a help topic to the html help engine

It took me about 3 minutes of searching on to find this:

   - Mike
Mike J. Brown, software engineer at            My XML/XSL resources: in Denver, Colorado, USA    

 XSL-List info and archive:

Current Thread