I am working on a project with XSLT and XML files.
I need to add logic to the XSLT to check if a colon has been entered into the FTYP_Location, and if it has I need everything BEFORE the colon removed (including the colon). Here is an example of the data that needs to be parsed:
SAINT MARY FL:@TARGET
Below is the XSLT that I am currently using (the FTYP_LOCATION is the field that will be modified by the IF statement).
<xsl:template match="fieldEvent">
<MobResMDT>
<xsl:call-template name="header" />
<request>
<FieldEvent>
<FTYP_TYCOD>
<xsl:value-of select="type" />
</FTYP_TYCOD>
<FTYP_SUBTYCOD>
<xsl:value-of select="subtype" />
</FTYP_SUBTYCOD>
<FTYP_LOCATION>
<xsl:value-of select="location" />
</FTYP_LOCATION>
<FTYP_CMNTS>
<xsl:value-of select="comments" />
</FTYP_CMNTS>
<FTYP_PLATE swtype="swchar">
<xsl:value-of select="plateNumber" />
</FTYP_PLATE>
</FieldEvent>
</request>
</MobResMDT>
</xsl:template>
The other thing that could be done, is instead of checking for a colon, we could remove everything before the "@" sign that will be in the code.
I have tried writing the necessary if statement, but have failed numerous times. Any help is greatly appreciated!
Cannot properly hammer down the IF statements (I'm used to working in object-oriented programming, not data fields like XML)
Aucun commentaire:
Enregistrer un commentaire