ich möchte hinzufügen "xmlns" - Attribut in der xml-Datei mit xslt

Möchte ich folgende xml-Datei ausgegeben:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
- <T0020 xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1">
- <INTERFACE>
  <NAME>SAFER</NAME> 
  <VERSION>04.02</VERSION> 
  </INTERFACE>

dafür habe ich folgende xslt-Datei:

<xsl:template match="T0020" >
    <xsl:copy>
    <xsl:attribute name="xsi:schemaLocation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd </xsl:attribute>

  //some code here...............//

 <xsl:copy>

also ich add xmlns="http://www.safersys.org/namespaces/T0020V1" - Attribut unter <T0020> tag??

  • Gute Frage (+1). Siehe meine Antwort für eine kurze und einfache Lösung. 🙂
InformationsquelleAutor Saumil Bhatt | 2010-07-27
Schreibe einen Kommentar