Mixing XSLT, ordinary XML and/or possibly XSD

makisu

New Member
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. \[code\]\textbf{bold}\[/code\]. 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:[*]Config file for the proprietary tool which translates \[code\]\textbf{bold}\[/code\] to \[code\]<Cmd Name="strong"><param Nr="1">bold</param></Cmd>\[/code\][*]XSLT file which translates the XML code above to \[code\]<myns:strong>bold</myns:strong>\[/code\][*]An XSD file describing the allowed tags and formats[*]Multiple xsl files for translating \[code\]<myns:strong>bold</myns:strong>\[/code\] to different output formats (e.g. back to \[code\]\textbf{bold}\[/code\])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:\[code\]<!-- 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>\[/code\]which would be much easier to maintain.
 
Back
Top