Home Page › Forums › BizTalk 2004 – BizTalk 2010 › deleting -1 on mapping
- This topic has 3 replies, 1 voice, and was last updated 6 years, 10 months ago by
community-content.
-
AuthorPosts
-
-
May 6, 2006 at 1:41 AM #14624
Try this:
[code:1:a4ca6e4ea9]<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\" version=\"1.0\">
<xsl:output omit-xml-declaration=\"yes\" method=\"xml\" version=\"1.0\" />
<xsl:template match=\"/\">
<xsl:call-template name=\"recursive\"/>
</xsl:template>
<xsl:template name=\"recursive\">
<xsl:for-each select=\"attribute::*\">
<xsl:variable name=\"var:a1\" select=\"local-name()\"/>
<xsl:attribute name=\"{$var:a1}\">
<xsl:value-of select=\".\"/>
</xsl:attribute>
</xsl:for-each>
<xsl:for-each select=\"child::*\">
<xsl:variable name=\"var:name\" select=\"local-name()\"/>
<xsl:variable name=\"var:ns\" select=\"namespace-uri()\"/>
<xsl:choose>
<xsl:when test=\"count(child::*) > 0\">
<xsl:element namespace=\"{$var:ns}\" name=\"{$var:name}\">
<xsl:call-template name=\"recursive\"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:if test=\"./text() != ‘-1’\">
<xsl:element namespace=\"{$var:ns}\" name=\"{$var:name}\">
<xsl:value-of select=\".\"/>
</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>[/code:1:a4ca6e4ea9] -
May 6, 2006 at 2:03 AM #14625
Forgot about blank nodes.
i.e. <Record type=\”27\”/>[code:1:49afc212aa] <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\" version=\"1.0\">
<xsl:output omit-xml-declaration=\"yes\" method=\"xml\" version=\"1.0\" />
<xsl:template match=\"/\">
<xsl:call-template name=\"recursive\"/>
</xsl:template>
<xsl:template name=\"recursive\">
<xsl:for-each select=\"attribute::*\">
<xsl:variable name=\"var:a1\" select=\"local-name()\"/>
<xsl:attribute name=\"{$var:a1}\">
<xsl:value-of select=\".\"/>
</xsl:attribute>
</xsl:for-each>
<xsl:for-each select=\"child::*\">
<xsl:variable name=\"var:name\" select=\"local-name()\"/>
<xsl:variable name=\"var:ns\" select=\"namespace-uri()\"/>
<xsl:choose>
<xsl:when test=\"count(child::*) > 0\">
<xsl:element namespace=\"{$var:ns}\" name=\"{$var:name}\">
<xsl:call-template name=\"recursive\"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:if test=\"(text() != ‘-1’) or (string-length(text()) = 0)\">
<xsl:element namespace=\"{$var:ns}\" name=\"{$var:name}\">
<xsl:for-each select=\"attribute::*\">
<xsl:variable name=\"var:a1\" select=\"local-name()\"/>
<xsl:attribute name=\"{$var:a1}\">
<xsl:value-of select=\".\"/>
</xsl:attribute>
</xsl:for-each>
<xsl:value-of select=\".\"/>
</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>[/code:1:49afc212aa]-
May 5, 2006 at 11:01 AM #14626
Ok, so here is what I’m trying!
Have a map with 2 identical schemas as Source and Destination schema!I want a custom XSLT that deletes nodes that have -1 values from the source, making the destination schema have less nodes than the source.
Any help!? Is it possible!?
Thanks in adavance!
-
May 8, 2006 at 1:46 PM #14627
greg.forsythe,
thanks!
Didn’t use your schema… but it gave me an ideia, and it’s now working!
Thanks a million! 🙂
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.