Results 1 to 3 of 3

Thread: [RESOLVED] create named <a> from XML attribute

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Location
    London
    Posts
    10

    Question [RESOLVED] create named <a> from XML attribute

    Hi there

    Does anyone have a clue how you would create a named
    anchor in a stylesheet or HTML from an XML element attribute?

    Example:
    In my XML file I have this:

    <category catName="General">


    In my XSL file I have something like this:

    <a name="??????"></a>

    what do I need to replace the "??????" with to have set
    name="General" i.e. the attribute value of @catName?


    I've seen something on a website that suggests something like:

    <a name="{@catName}"></a>

    but can't get it to work.... :-(

    Any help is appreciated...

    Thanks
    Last edited by deeperdish; Jan 23rd, 2004 at 05:40 AM.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    There's an xsl:attribute element. Or something functionally equivalent. What it does is inserting a generated attribute into the parent node, which is exactly what you need.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Location
    London
    Posts
    10

    [RESOLVED] create named <a> from XML attribute

    Thanks Cornbee!

    Here's what I did:

    Code:
    <span style="font: bold 16px arial; color:white"><xsl:value-of select="@catName"/>
    <a>
    	<xsl:attribute name="name">
    		<xsl:value-of select="@catName"/>
    	</xsl:attribute>
    </a>
    </span>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width