xml - Preserving html tags in xslt -


i want preserve html tags using xslt. example have xml structure: <adaptation> <body> <p> <t>consultez l'offre de formation en ligne (en cliquant sur le niveau souhaité dans le schéma ci-dessous)</t> </p> </body> </adaptation>.

i want preserve tags <body>, <p>... tried use copy-of, doesn't work:

`<xsl:template name="insertinfo">     <xsl:param name="id"/>     <xsl:param name="objet"/>     <xsl:param name="valeurinfo"/>      <xsl:text>insert information(idobjet, objetnom, valeurinfo)  values (" </xsl:text>     <xsl:value-of select="$id"/>     <xsl:text>", "</xsl:text>     <xsl:value-of select="$objet"/>     <xsl:text>", "</xsl:text>     <xsl:copy-of select="$valeurinfo"/>      <xsl:text>");&#xa;</xsl:text> </xsl:template> `  `<xsl:variable name="valeurinfo"> <xsl:value-of select="./adaptation"/>  </xsl:variable>  <xsl:call-template name="insertinfo">     <xsl:with-param name="id" select="$idobjet" /> <xsl:with-param name="objet" select="$noeud" /> <xsl:with-param name="valeurinfo" select="$valeurinfo"/>  </xsl:call-template>`. 

i tried use copy-of when i'm creating var "valeurinfo". result text. thank help.

<xsl:variable name="valeurinfo">   <xsl:value-of select="./adaptation"/> </xsl:variable> 

will set variable string value of adaptation element, means concatenation of it's descendant text nodes without intervening tags. if instead say

<xsl:variable name="valeurinfo" select="./adaptation"/> 

then make variable hold reference adaptation element node itself, rather element's value.

if want content inside adaptation element not <adaptation>...</adaptation> tags try

<xsl:variable name="valeurinfo" select="./adaptation/node()"/> 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -