Insert one value in my XSLT code

Discussion in 'XML' started by shapper, Oct 27, 2006.

  1. shapper

    shapper Guest

    Hello,

    I am transforming a XML file into another XML file using a XSLT.

    Everything is working fine! I have only one problem:

    I want one of the values in my XSLT file to be taken from a Key in my
    Web.Config AppSettings!

    Please see the XSLT code:

    Hi,

    I was reading some Merge Methods in the web but I am having some
    problems making this work.

    Look at my XSLT code:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.google.com/schemas/sitemap/0.84"
    xmlns:dk="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
    <xsl:eek:utput method="xml" version="1.0" encoding="UTF-8"
    indent="yes"/>
    <xsl:template match="dk:*"/>
    <xsl:template match="@*|text()|comment()"/>
    <xsl:template match="/">
    <xsl:element name="urlset">
    <xsl:apply-templates select="//dk:siteMapNode[@google='true']"/>
    </xsl:element>
    </xsl:template>
    <xsl:template match="dk:siteMapNode">
    <xsl:element name="url">
    <xsl:element name="loc">
    <xsl:text>http://www.MYDOMAIN.com/</xsl:text>
    <xsl:value-of select="substring(@url, 3)"/>
    </xsl:element>
    <xsl:element name="lastmod">
    <xsl:value-of select="@lastmod"/>
    </xsl:element>
    <xsl:element name="changefreq">
    <xsl:value-of select="@changefreq"/>
    </xsl:element>
    <xsl:element name="priority">
    <xsl:value-of select="@priority"/>
    </xsl:element>
    </xsl:element>
    </xsl:template>
    </xsl:stylesheet>

    Do you see the line?

    <xsl:text>http://www.MYDOMAIN.com/</xsl:text>

    I want "http://www.MYDOMAIN.com/" to be taken from a Key in Application
    Settings in my Web.Config or at run time before the XML file is
    displayed.

    Thanks,

    Miguel
    shapper, Oct 27, 2006
    #1
    1. Advertising

  2. Read up on stylesheet parameters, or extension functions, depending on
    how your execution environment works.
    Joseph Kesselman, Oct 27, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. loveNUNO
    Replies:
    2
    Views:
    907
    loveNUNO
    Nov 20, 2003
  2. shapper
    Replies:
    0
    Views:
    359
    shapper
    Oct 27, 2006
  3. shapper
    Replies:
    0
    Views:
    377
    shapper
    Oct 27, 2006
  4. Replies:
    1
    Views:
    1,777
    Albert Hopkins
    Dec 6, 2008
  5. Sergio del Amo
    Replies:
    4
    Views:
    233
Loading...

Share This Page