Jump to content
Sign in to follow this  
wendi7

Getting value of unparsed entity in spawned node document fragment

Recommended Posts

I have a some System Entities defined our my Master xml (that has entity references to contained xml's) that I use to get image locations using (unparsed-entity-ur). Which works fine, except for the case where the xml has a figure object with comments:note attribute, and then a contained <graphic> which uses entity reference to resolve the image source. Without the comment:note of the figure, it resolves fine. The problem is my comment xslt template creates a document fragment of the node containing the comment without the comment attribute resulting from xsl copy-of function, so it is now not connected to the main document anymore, so when it is done transforming the content, when trying to resolve 'unparsed-entity-uri' returns blank. So, my question is, is there anyway to still reference the entity, or pass the value/reset the value/set value to another parameter/etc around this new document fragment so that I can still get the source value of the image? The xsl calls are below that creates the new document fragment. For the graphic tag, which occurs after the comment, have another template where I call the 'unparsed-entity-uri' of a name passed in from the xml, but just returns blank. <xsl:template>.... <xsl:variable name='decommented-node'> <xsl:call-template name='decomment'> <xsl:with-param name="node" select='.' /> </xsl:call-template> </xsl:variable> <!-- Apply the template for the decommented node. Need to drill down into the document fragment that contains that node. And, for good measure, pick the first child. --> <xsl:apply-templates select='$decommented-node/*[1]'/> </xsl:when> <xsl:otherwise> <!-- We haven't yet shown title. Process all nodes. --> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <!-- Do NOT render --> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name='decomment'> <xsl:param name='node' select='.'/> <xsl:element name='{name($node)}'> <xsl:for-each select="$node/*[name()!=title]|text()|$node/@*[name()!=comment]"> <xsl:copy-of select="."/> </xsl:for-each> </xsl:element> </xsl:template>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...