XSLT to generate xsl fo from HTML with varying namespace -


i have xslt file used html xsl-fo conversion using fop engine. has templates html elements shown below

<pre>      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform"                     xmlns:fo="http://www.w3.org/1999/xsl/format"                     version="2.0">      <xsl:template match="html">     //handle html element     </xsl:template>      <xsl:template match="head/title">     //handle head/title elements     </xsl:template>      </xsl:stylesheet>  </pre> 

i need convert kinds of html files provided input processor. html files without namespace processed without issues. however, html files have name space (<html xmlns="http://www.w3.org/1999/xhtml">) in case fop processor throwing exceptions. best way handle sort of cases? can create template ,based on local-name(), call correct template?

my preference in kind of situation normalize input before doing else, in separate pass. done template rule this:

<xsl:template match="*">   <xsl:element name="lower-case(local-name())">     <xsl:copy-of select="@*"/>     <xsl:apply-templates/>   </xsl:element> </xsl:template> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -