AnsweredAssumed Answered

Custom XSL Formatting for HTML Popup in ArcMap

Question asked by johnmdye on Sep 10, 2014
Latest reply on Sep 11, 2014 by mbockenhauer-esristaff

I'm not very well versed with XSL but have been tinkering to try and get an XSL Template to iframe a Birds Eye view into the HTML Popup window for the feature that gets clicked on. This actually works as it as, however what it requires in order to function is that I create an additional field in my attribute table named 'BIRDSEYE' and calculate the X and Y coordinates of the feature's into that field, with the X and Y coordinates separated by a tilde.

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <xsl:template match="/">
            <html>
                 <head>
                      <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
                 </head>
                 <body>
                    <xsl:variable name="nameCol" select="FieldsDoc/Fields/Field/FieldName"/>
                    <table border="1" width="450" cellpadding="5" cellspacing="0">
                        <xsl:variable name="index" select="1"/>
                        <xsl:for-each select="FieldsDoc/Fields/Field">
                            <tr>
                                <xsl:if test="(position() +1) mod 2">
                                    <xsl:attribute name="bgcolor">#D4e4f3</xsl:attribute>
                                </xsl:if>
                                <xsl:if test="string-length($nameCol) != 0">
                                    <td>
                                        <xsl:value-of select="FieldName"/>
                                    </td>
                                </xsl:if>
                                <td>
                                    <xsl:choose>
                                        <xsl:when test="FieldName[starts-with(., 'BIRDSEYE')]">
                                            <xsl:variable name="BEV" select="FieldValue"/>
                                            <iframe src="http://dev.virtualearth.net/embeddedMap/v1/ajax/BirdseyeWithLabels?zoomLevel=18&center={$BEV}&amp;pushpins={$BEV}&amp;culture=en-us" width="450" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="FieldValue"/>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </td>
                            </tr>
                        </xsl:for-each>
                    </table>
                  </body>
            </html>
      </xsl:template>
</xsl:stylesheet>

 

I'd like to not have to add that additional field and just have the XSL Stylesheet reference the LAT and LON fields that already exist in all of my attribute tables, do the concatenation and formatting of the extracted coordinates on its own and place the iframe before the table begins so that it is the first thing you see, followed by the attribute table.

 

Tinkering around, the issue I'm having seems to be that because I am creating the BEV_X and BEV_Y variables inside of the XSL Stylesheet, they have local scope and thus are not available outside of their <xsl:if> statements.

 

How can I make them accessible outside of the if statement so that if can be dynamically populated into the iframe?

Outcomes