xslt - How to reject xml records if not in specific date format -
xslt - How to reject xml records if not in specific date format -
i have case study need reject xml record if not in format hh:mm:ss
. can any1 help me how can using xslt's.
<data> <rec> 12:32:56 </rec> <rec> 20141104093903 </rec> <data>
so should reject sec record....
try next stylesheet:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:strip-space elements="*"/> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="/"> <data> <xsl:apply-templates select="data/rec[contains(., ':')]"/> </data> </xsl:template> <xsl:template match="rec"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet>
when applied our input xml, produces
<data> <rec> 12:32:56 </rec> </data>
date xslt
Comments
Post a Comment