res_geolocation: Add profile parameter suppress_empty_ca_elements

Added profile parameter "suppress_empty_ca_elements" that
will cause Civic Address elements that are empty to be
suppressed from the outgoing PIDF-LO document.

Fixed a possible SEGV if a sub-parameter value didn't have a
value.

ASTERISK-30177

Change-Id: I924ccc5aa2f45110a3155b22e53dfaf3ef2092dd
This commit is contained in:
George Joseph
2022-08-17 07:15:00 -06:00
parent e9ae638978
commit d6f6a30a49
9 changed files with 74 additions and 32 deletions

View File

@@ -13,6 +13,7 @@
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="suppress_empty_ca_elements" select="false()"/>
<!-- REMINDER: The "match" and "select" xpaths refer to the input document,
not the output document -->
@@ -80,9 +81,11 @@
each element, adding the "ca" namespace -->
<xsl:template match="civicAddress/*">
<xsl:element name="ca:{name()}">
<xsl:value-of select="."/>
</xsl:element>
<xsl:if test="not($suppress_empty_ca_elements) or boolean(node())">
<xsl:element name="ca:{name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template match="location-info/civicAddress">