Create XSLT from an XML to get desired XML -


i have situation here : consider following code example :

    <?xml version="1.0" encoding="utf-8"?> <school id="1" alias="abc" name="st.josephs" val="">     <teacher id="1">rose</teacher>     <subject>maths</subject>     </school> <school id="2" alias="bcd" name="" val="">     <teacher id="2">john</teacher>     <subject>science</subject> </school> <school id="3" alias="abc" name="" val="">     <student rollno="12">sarah</student>     <age>13</age>  </school> <school id="4" alias="bcd" name="st.mary's" val="">         <student rollno="14">rosh</student>         <age>14</age> </school> 

now here need design xslt create elements having data element alias abc, bcd simultaenously output :

<institutes>     <group>     <content>             <![cdata[       <html>       <head>        <title>'rose' 'maths' teacher</title>       </head>       <body>           rose maths teacher sarah in st.josephs school       </body>       </html>    ]]>     </content>     </group> </institutes> <institutes>     <group>         <content>             <![cdata[       <html>       <head>        <title>'john' 'science' teacher</title>       </head>       <body>           john science teacher rosh in st.mary's school       </body>       </html>    ]]>         </content>     </group> </institutes>   there way achieve this..?? 

you need use xsl:output element @ top of stylesheet list elements need cdata, way:

<xsl:output method="xml" ... cdata-section-elements="content" /> 

the attribute cdata-section-elements tells xslt processor element content must written cdata section.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -