Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. How to Handle Inline Markup Elements in XSLT

How to Handle Inline Markup Elements in XSLT

Scheduled Pinned Locked Moved XML / XSL
xmlcsharppythonhtml
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nick Rioux
    wrote on last edited by
    #1

    Say I have this XML Document:

    <?xml version="1.0" encoding="UTF-16"?>
    <?xml-stylesheet type="text/xsl" href="MyXsl.xsl"?>
    <page>
    <para>
    Test paragraph.
    </para>

    <para>
    	Test <link href="codeproject.com">link</link>.
    </para>
    

    </page>

    In XSLT, how would you change <link href into <a href? I have this so far...

    <xsl:template match="/">
    ...
    <xsl:for-each select="//para">
    <xsl:call-template name="paragraph"/>
    </xsl:for-each>
    ...
    </xsl:template>

    <xsl:template match="//para" name="paragraph">
    <p>
    <xsl:value-of select="."/>
    </p>
    </xsl:template>

    Thanks! I've tried Google, but couldn't find anything useful.


    Fluent in VB, Attempts to speak C#, Python, English ;)
    ---
    File Association in VB.Net
    Creating Custom Controls: Casino Royale

    G 1 Reply Last reply
    0
    • N Nick Rioux

      Say I have this XML Document:

      <?xml version="1.0" encoding="UTF-16"?>
      <?xml-stylesheet type="text/xsl" href="MyXsl.xsl"?>
      <page>
      <para>
      Test paragraph.
      </para>

      <para>
      	Test <link href="codeproject.com">link</link>.
      </para>
      

      </page>

      In XSLT, how would you change <link href into <a href? I have this so far...

      <xsl:template match="/">
      ...
      <xsl:for-each select="//para">
      <xsl:call-template name="paragraph"/>
      </xsl:for-each>
      ...
      </xsl:template>

      <xsl:template match="//para" name="paragraph">
      <p>
      <xsl:value-of select="."/>
      </p>
      </xsl:template>

      Thanks! I've tried Google, but couldn't find anything useful.


      Fluent in VB, Attempts to speak C#, Python, English ;)
      ---
      File Association in VB.Net
      Creating Custom Controls: Casino Royale

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      I hope the following will give you some ideas:<?xml version="1.0"?> <page> <para> Test paragraph </para> <para> A good place to find source code is <link href="http://www.codeproject.com">CodeProject</link> </para> </page> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   <xsl:template match="/page"> <xsl:apply-templates select="para"/> </xsl:template>   <xsl:template match="para"> <p><xsl:apply-templates select="child::text() | link"/></p> </xsl:template>   <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template>   <xsl:template match="link"> <a href="{@href}"><xsl:value-of select="."/></a> </xsl:template>   </xsl:stylesheet>

      "We make a living by what we get, we make a life by what we give." --Winston Churchill

      N 1 Reply Last reply
      0
      • G George L Jackson

        I hope the following will give you some ideas:<?xml version="1.0"?> <page> <para> Test paragraph </para> <para> A good place to find source code is <link href="http://www.codeproject.com">CodeProject</link> </para> </page> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   <xsl:template match="/page"> <xsl:apply-templates select="para"/> </xsl:template>   <xsl:template match="para"> <p><xsl:apply-templates select="child::text() | link"/></p> </xsl:template>   <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template>   <xsl:template match="link"> <a href="{@href}"><xsl:value-of select="."/></a> </xsl:template>   </xsl:stylesheet>

        "We make a living by what we get, we make a life by what we give." --Winston Churchill

        N Offline
        N Offline
        Nick Rioux
        wrote on last edited by
        #3

        Thanks a lot!


        Fluent in VB, Attempts to speak C#, Python, English ;)
        ---
        File Association in VB.Net
        Creating Custom Controls: Casino Royale

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups