Re: XML serialization - missing data! - PLEASE HELP
Re: XML serialization - missing data! - PLEASE HELP
- Subject: Re: XML serialization - missing data! - PLEASE HELP
- From: Robert Walker <email@hidden>
- Date: Mon, 31 Jul 2006 09:33:18 -0400
Amedeo,
Apple says:
The "id" attribute refers to the identification number of an element
representing an object. It is generated the first time the object is
encountered during serialization. Subsequent references to the
same object use
the attribute "idRef" instead of a new element with the complete
object
description.
but when I simplify the schema using XSLT SimpleTrasformation.xsl I
lose objects at all... only first instance is wrote, other have no
instance and no references, are completely discarded !
You need to solve the reference issue in your XSLT. It took me a
while to come up with this solution, and there may be a better way to
do it. I'm not yet and XSLT expert, but my solution seems to work
fine. See this example below, which is an excerpt from my XSLT file:
------------------------------------------------------------------------
---------------
<xsl:template match="woxml:object">
<xsl:variable name="tag">
<xsl:call-template name="getTagName" />
</xsl:variable>
<xsl:variable name="type" select="woxml:class/@name" />
<!-- store possible reference to another element -->
<xsl:variable name="ref">
<xsl:value-of select="@idRef" />
</xsl:variable>
<xsl:choose>
<xsl:when test="string(@idRef)">
<xsl:apply-templates select="//*[@id=$ref]" />
</xsl:when>
<xsl:otherwise>
<xsl:if test="$tag!='' and not(string(@idRef))">
<xsl:element name="{$tag}">
<xsl:choose>
<xsl:when test="$type='java.lang.Double' or
$type='java.lang.Integer' or $type='java.lang.Boolean'">
<xsl:value-of select="woxml:double | woxml:int |
woxml:boolean" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
------------------------------------------------------------------------
---------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden