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. XSL general question

XSL general question

Scheduled Pinned Locked Moved XML / XSL
xmlhelpquestionlounge
3 Posts 3 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.
  • P Offline
    P Offline
    picazo
    wrote on last edited by
    #1

    Hi, I am new to XSL and I was hoping someone could help me with a problem I am having. I have an Input.xml file to which I want to apply a xsl stylesheet Style.xsl. I also have a Template.xml file which I want to use as the base for the output file. At the moment, here is what I have: I seem to be doing this backwards, here is what I want A

    L D 2 Replies Last reply
    0
    • P picazo

      Hi, I am new to XSL and I was hoping someone could help me with a problem I am having. I have an Input.xml file to which I want to apply a xsl stylesheet Style.xsl. I also have a Template.xml file which I want to use as the base for the output file. At the moment, here is what I have: I seem to be doing this backwards, here is what I want A

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      picazo wrote:

      I have an Input.xml file to which I want to apply a xsl stylesheet Style.xsl. I also have a Template.xml file which I want to use as the base for the output file.

      So you are trying to use 2 XML files in the XSLT right? There may be support for that in XSLT 2.0 I am not sure. Even if there is there may not be an engine that supports it yet, I don't know. However:

      picazo wrote:

      I also have a Template.xml file which I want to use as the base for the output

      That is what the XSLT is for so you may just be over complicating your solution. You should only need the XSLT file and a single XML input file.

      led mike

      1 Reply Last reply
      0
      • P picazo

        Hi, I am new to XSL and I was hoping someone could help me with a problem I am having. I have an Input.xml file to which I want to apply a xsl stylesheet Style.xsl. I also have a Template.xml file which I want to use as the base for the output file. At the moment, here is what I have: I seem to be doing this backwards, here is what I want A

        D Offline
        D Offline
        Dustin Metzgar
        wrote on last edited by
        #3

        picazo wrote:

        <xsl:template match="@* | node()">
        xsl:copy
        <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
        </xsl:template>

        This code is really your problem. You should try matching differently. Instead of doing this, try replacing it with:

        <xsl:template match="/">
        <TemplateRoot>
        <xsl:for-each select="InputRoot/elem">
        <xsl:apply-templates select="."/>
        </xsl:for-each>
        </TemplateRoot>
        </xsl:template>

        The code may not be exactly correct because I was too lazy to test it. I think it's a neat idea to mix two XML files, but it depends on your requirements. In most cases, you would want to adjust the XSL instead of having a template XML file outside, like led mike suggested.

        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