Je veux faire une transformation XSLT 1.0 d'un xml où j'utilise le nœud. Maintenant, quand j'applique cela, il définit un espace de noms xmlns sur les éléments copiés, est-il possible d'éviter cela?copy-of sans espace de noms dans xlst1.0
C'est le xml d'entrée:
<ns0:Task xmlns:ns0="http://Sharepoint.Task">
<UserName>FalcoLannoo</UserName>
<Title>Task1</Title>
<Description>Description_0</Description>
<Library>Library_0</Library>
<DueDate>1999-05-31</DueDate>
<Priority>10</Priority>
</ns0:Task>
Et j'utiliser cette xsl pour le transformer:
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0 ns0" version="1.0" xmlns:tns="http://schemas.microsoft.com/sharepoint/soap/" xmlns:ns1="http://microsoft.com/wsdl/types/" xmlns:s0="http://Sharepoint.Batch" xmlns:ns0="http://Sharepoint.Batch">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/s0:updates" />
</xsl:template>
<xsl:template match="/s0:updates">
<tns:UpdateListItems>
<tns:listName>
<xsl:value-of select="listName/text()" />
</tns:listName>
<tns:updates>
<xsl:copy-of select="/s0:updates/Batch" />
</tns:updates>
</tns:UpdateListItems>
</xsl:template>
</xsl:stylesheet>
Et le fichier de sortie est la suivante:
<tns:UpdateListItems xmlns:tns="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:ns1="http://microsoft.com/wsdl/types/">
<tns:listName>{58887260-E5EB-4AB5-B105-E5DD57C8C8E0}</tns:listName>
<tns:updates>
<Batch OnError="Continue" ListVersion="1" ViewName=""
xmlns:ns0="http://Sharepoint.Batch">
<Method ID="1" Cmd="New">
<Field Name="UserName">FalcoLannoo</Field>
<Field Name="Title">Task1</Field>
<Field Name="Description">Description_0</Field>
<Field Name="Library">Library_0</Field>
<Field Name="DueDate">1999-05-31</Field>
<Field Name="Priority">10</Field>
</Method>
</Batch>
</tns:updates>
</tns:UpdateListItems>
Et cela est la ligne dont je veux me débarrasser: xmlns: ns0 = "http: //Sharepoint.Batch" (dans le noeud Batch)
thx
Pouvez-vous publier votre code XSLT et le code XML que vous êtes en train de transformer? – Mark
ok, édité avec des échantillons de code. –
Je ne vois pas comment le XML d'entrée correspond à la feuille de style ou à la sortie? L'entrée XML parle aux éléments appelés ns0: Task et la feuille de style et la sortie parlent à Batch and Updates dans un espace de noms différent? – Robin