Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8154357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:19:10+00:00 2026-06-06T16:19:10+00:00

Do I need to expect problems when I add XML elements from a different

  • 0

Do I need to expect problems when I add XML elements from a different namespace to an XSLT file? Or are they just ignored (as would be great)?

Background: In a large project, the user can use user-defined tags for text formatting and so on (e.g. \textbf{bold}. They are first transformed to a specific dialect in XML (first using a proprietary tool and then XSLT) and afterwards possibly converted to other dialects such as latex, framemaker, BB code, …

For this reason there are currently the following files:

  1. Config file for the proprietary tool which translates \textbf{bold} to <Cmd Name="strong"><param Nr="1">bold</param></Cmd>
  2. XSLT file which translates the XML code above to <myns:strong>bold</myns:strong>
  3. An XSD file describing the allowed tags and formats
  4. Multiple xsl files for translating <myns:strong>bold</myns:strong> to different output formats (e.g. back to \textbf{bold})

Maintaining these files is very difficult because there is no real 1:1 mapping and adding a new command requires changing multiple files in the right way.

Therefore my idea would be to merge these. E.g. a single XML file would contain:

<!-- config file for proprietary tool -->
<repl:Cmd Name="strong"><repl:Param Nr="1"/></repl:Cmd>

<!-- converting to XML dialect -->
<xsl:template mode="Text" match="Cmd[@Name = 'textbf']">
   <myns:strong>
       <xsl:apply-templates select="Param[@Nr='1']" mode="Text"/>
   </myns:strong>
</xsl:template>

<!-- XSD schema for validating XML -->
<xsd:element name="strong" type="tns:GenericTextType">
</xsd:element>

<!-- converting XML dialect to latex code -->
<xsl:template match="myns:strong" mode="Text_toLatex">
    <xsl:text disable-output-escaping="yes">\textbf{</xsl:text>
       <xsl:apply-templates mode="Text_toLatex"/>
    <xsl:text disable-output-escaping="yes">}</xsl:text>
</xsl:template>

which would be much easier to maintain.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:19:11+00:00Added an answer on June 6, 2026 at 4:19 pm

    Do I need to expect problems when I add XML elements from a different namespace to an XSLT file? Or are they just ignored (as would be great)?

    There will be no problems. XSLT programs are regular XML documents, you can generally add any elements you like (namespace or not) to the document and they become part of the program.

    Note that you can use elements with a namespace everywhere, but elements without a namespace cannot be children of <xsl:stylesheet>.

    If they are children of an <xsl:template>, they will be output into the result. If they are children of the <xsl:stylesheet> itself, they are not output (i.e., they are “ignored”).

    All you must do is

    • declare the used namespaces so your XSLT stays well-formed (this is a basic XML requirement, you always must declare namespaces you use)
    • prevent the output of unneeded namespaces into the result document using the exclude-result-prefixes directive.

    .

    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:repl="http//tempuri.org/repl"
      xmlns:tns="http//tempuri.org/tns"
      xmlns:myns="http//tempuri.org/myns"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      exclude-result-prefixes="tns myns"
    > 
      <!-- config file for proprietary tool -->
      <repl:Cmd Name="strong"><repl:Param Nr="1"/></repl:Cmd>
    
      <!-- converting to XML dialect -->
      <xsl:template mode="Text" match="Cmd[@Name = 'textbf']">
        <myns:strong>
          <xsl:apply-templates select="Param[@Nr='1']" mode="Text"/>
        </myns:strong>
      </xsl:template>
    
      <!-- XSD schema for validating XML -->
      <xsd:element name="strong" type="tns:GenericTextType">
      </xsd:element>
    
      <!-- converting XML dialect to latex code -->
      <xsl:template match="myns:strong" mode="Text_toLatex">
        <xsl:text>\textbf{</xsl:text>
          <xsl:apply-templates mode="Text_toLatex"/>
        <xsl:text>}</xsl:text>
      </xsl:template>
    
    </xsl:stylesheet>
    

    Nothing will happen with <repl:Cmd> and <xsd:element> unless you write XSLT code that explicitly uses these nodes. They will be accessible through XPath like document('')/*/xsd:element (the * is a short-cut for xsl:stylesheet).

    In fact this is a common technique to store additional structured data – like configuration or look-up tables – in an XSLT document.


    Side note: You generally should not use disable-output-escaping. In your particular code it’s even superfluous.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC2 application and I need to add code from another application
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
I have this sitemap: <?xml version=1.0 encoding=utf-8 ?> <siteMap xmlns=http://schemas.microsoft.com/AspNet/SiteMap-File-1.0> <siteMapNode> <siteMapNode url=www.google.com title=Google
My App need to update the status and add images to the update, so
I subtract two dates from each other because I need the time difference between
I need to grab the folder name of a currently executing batch file. I
I am dealing with an issue and need some expert advice on to achieve
I need a regex expert to help out on this one. Examples I've found
I need to upload an image to a remote PHP server which expects the
i need to convert a Utf-16BE in ISO-8859-1 in PHP (i'm not an expert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.