Guest NenadP Posted February 16, 2009 Share Posted February 16, 2009 Hello,I'm brand new to this forum so thought you might be able to help me. W3Schools is a great resource I have only recently come across. I work as a geographic information systems (GIS) analyst for a local government in New Zealand and am currently creating a Google Earth KML service via ArcGIS Server so that some of our residents (and beyond) can view the City's community facilities, places for recreation and leisure as well as some other useful spatial data. The GIS side of things works very well - it's the HTML Pop-Ups of GIS data attributes that I am having one slight issue with:Is there a way to have the XSL code display a URL "alias" instead of the full URL that is included in the GIS layer's "webpage" attribute, (i.e. instead of the absolute value stored in the attribute tables)?If you have a look at the attachments here ( First Screenshot Link Second Screenshot Link )and the code below, the XSL stylesheet looks for field values that begin with "http://" and make them into "href" hyperlinks. Can there be an alias there that always displays a word such as "Click Here" that would also take the user to the URL? I just think that it would look better if an alias word was displayed instead of the entire long URL. I have successfully done this for the HTML segments (the text footers of the HTML pop-ups) using the ahref tag alongside a text alias. If anyone can help me with this or point me in the right direction, I would greatly appreciate that. Kind Regards, Nenad Petrovic <?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><body><a href="http://www.wellington.govt.nz/"><img border="0" src="http://intranet/images/apw-logo-new2.gif" alt="Wellington City Council Home Page"width="110" height="58" style="float:right"> <br /></img></a><p style="font-family:verdana;color:DimGray"> <big> <b>Libraries </b> </big></p></body></html> <html> <body> <xsl:variable name="nameCol" select="FieldsDoc/Fields/Field/FieldName"/> <table border="1" width="300" 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">LightGrey</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(., 'imag')]"> <xsl:variable name="imageURL" select="FieldValue"/> <p><img border="0" src="{$imageURL}" width="355" height="272"></img></p> </xsl:when> <xsl:when test="FieldValue[starts-with(., 'www.')]"> <a target="_blank"><xsl:attribute name="href">http://<xsl:value-of select="FieldValue"/> </xsl:attribute><xsl:value-of select="FieldValue"/> </a> </xsl:when> [color="#FF0000"] <xsl:when test="FieldValue[starts-with(., 'http:')]"> <a target="_blank"><xsl:attribute name="href"><xsl:value-of select="FieldValue"/> </xsl:attribute><xsl:value-of select="FieldValue"/> </a> </xsl:when>[/color] <xsl:when test="FieldValue[starts-with(., 'https:')]"> <a target="_blank"><xsl:attribute name="href"><xsl:value-of select="FieldValue"/> </xsl:attribute><xsl:value-of select="FieldValue"/> </a> </xsl:when> <xsl:when test="FieldValue[starts-with(., '\\')]"> <a target="_blank"><xsl:attribute name="href"><xsl:value-of select="FieldValue"/> </xsl:attribute><xsl:value-of select="FieldValue"/> </a> </xsl:when> <xsl:otherwise> <xsl:value-of select="FieldValue"/> </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:for-each> </table> </body> </html><html><body><center><p> For more information, visit the <a href="http://www.wellington.govt.nz/services/libraries/"> Overview</a> and <a href="http://www.wcl.govt.nz/"> Wellington City Libraries</a> pages.</p></center><center><i>If you would like to report any issues with <br /> GIS data used in this service, contact the <br />Wellington City Council <a href="mailto:GISOperationsTeam@wcc.govt.nz?subject=KML%20Service%20Query">GIS Operations Team</a></i></center></body></html> </xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
mitchwiniecki@yahoo.com Posted September 21, 2010 Share Posted September 21, 2010 Hi Nenad, I have been following your posts here and on the esri forums as I am wondering the same thing. I can't find much info on the topic, nor does anyone seem to know the answer to this question. Have you found a solution yet??I'm exploring code on my own, but my solution however will not hyperlink my text 'Click here' to the http: url located in the attribute table. This is as far as I've gotten. <xsl:when test="FieldName[starts-with(., 'StoreURL')]"> <a target="_blank"><xsl:variable name="href" select="FieldValue"/> <a href="FieldValue">Click here</a> </a>Thanks, Mitchell_W Link to comment Share on other sites More sharing options...
Martin Honnen Posted September 21, 2010 Share Posted September 21, 2010 Can you post a sample of the XML input you are processing and the corresponding HTML you want to create with XSLT?Your current sample does not make much sense as it nests two "a" elements.Also state whether you use XSLT 1.0 or 2.0. Link to comment Share on other sites More sharing options...
mitchwiniecki@yahoo.com Posted September 22, 2010 Share Posted September 22, 2010 ESRI forums will not currently let me create an album to publish my photos publicly. My custom popup will show my company logo, Retailer Corp logo (with href links for each logo), 'Click here' links to retailer website and individual store website, Aerial photo of individual store, and site-plan of store complex.Below is my code. <?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><body><a href ="http://www.welshco.com/Home.aspx/"><img border="0" src="http://www.ustrea.org/images/logo-welsh-companies.jpg"width="110" height="58" style="float:right"> <br /></img></a><a href ="http://www.target.com/"><img border="0" src="http://blogs.ft.com/techblog/files/2009/08/target_frame.jpg"width="150" height="90" style="top:left"> <br /></img></a></body></html> <html> <body> <xsl:variable name="nameCol" select="FieldsDoc/Fields/Field/FieldName"/> <table border="1" width="300" cellpadding="5" cellspacing="0"> <xsl:variable name="index" select="4"/> <xsl:for-each select="FieldsDoc/Fields/Field"> <tr> <xsl:if test="(4+1)"> <xsl:attribute name="bgcolor">LightGrey</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(., 'Aerial')]"> <xsl:variable name="imageURL" select="FieldValue"/> <p><img border="0" src="{$imageURL}" width="355" height="272"></img></p> </xsl:when> <xsl:when test="FieldName[starts-with(., 'Site_')]"> <xsl:variable name="imageURL" select="FieldValue"/> <p><img border="0" src="{$imageURL}" width="355" height="272"></img></p> </xsl:when> <xsl:when test="FieldName[starts-with(., 'Company')]"> <a target="_blank"><a href ="http://www.target.com/">Click here</a> </a> </xsl:when> <xsl:when test="FieldName[starts-with(., 'StoreURL')]"> <a href="{@URL}">Click here</a> </xsl:when> <xsl:otherwise> <xsl:value-of select="FieldValue"/> </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:for-each> </table> </body> </html><html></xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
Martin Honnen Posted September 22, 2010 Share Posted September 22, 2010 Well I asked for a sample of your XML input and for the sample of the corresponding output you want to create with XSLT, to then show you how to achieve that with XSLT. I am afraid posting some XSLT does not tell me what you want to achieve. Link to comment Share on other sites More sharing options...
mitchwiniecki@yahoo.com Posted September 28, 2010 Share Posted September 28, 2010 Here is a link to my custom popup. http://forums.arcgis.com/attachment.php?at...mp;d=1285690251The 'click here' for the compay URL is hard coded for the main Target website. The store URL however is a work in progress and I would like it to read individual store URL's in the attribute table, such as: http://sites.target.com/site/en/spot...p%3Fstate%3DMN Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.