xslt - how to refer the value of an xml tag that is passed as value to another xml using xsl -
i have xml goes this:
<root> <content> <paragraph> <image reference="folder-1/folder-2/imagefile.xml"/> </paragraph> </content> </root>
in reference "folder-1/folder-2/imagefile.xml", have path of image file value xml tag.
how access image file , pass path value tag's src attribute?
i tried solution posted in read properties file or text file in xsl, did not work. there other way can done? welcome. in advance.
edited:
the imagefile.xml contains following code:
<container> <element> <imagepath> folder/folder/imagename.jpg </imagepath> <altimage> folder/folder/altimage.jpg </altimage> </element> </container>
when meant solution did not work meant img tag coming in html output has src attribute's value empty this: <img src="" alt=""></img>
the xsl template use this:
<xsl:template match="image"> <img src="{./container/element/imagepath}"/> </xsl:template>
the image tag expect come this
<img src = "folder/folder/imagename.jpg"/>
but comes empty. in firefox, see thumbnail broken image, kind of 1 when there no image.
hope helps
<xsl:template match="/"> <good> <xsl:variable name="seconddata" select="document(root/content/paragraph/image/@reference)"/> <img> <xsl:attribute name="src"> <xsl:value-of select="$seconddata//altimage"/> </xsl:attribute> </img> </good> </xsl:template>
only thing important "imagefile.xml" file should within same directory, source or first xml is!! have used .net's own xslcompiledtransform , parser looks within folder source xml comes.
Comments
Post a Comment