[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] filtering maps by key characteristics?
Hello -- I have a content set traversal that creates map entries when it finds id attributes in the source tree; one map entry maps a generated GUID to the node with the id attribute, and another map entry maps the value of the id attribute to the same GUID. The result is stored as a sequence of singleton maps: <xsl:variable as="map(*)+" name="traversalMap"> <xsl:apply-templates mode="traverse" select="$contentSet" /> </xsl:variable> This sequence of ~map entries then get filtered into two merged maps, one with the GUID-to-element mapping, and one with the id-value-to-GUID mapping: <xsl:variable as="map(xs:string,element())" name="GUID2nodeMap"> <xsl:map> <xsl:sequence select="$traversalMap ! .[starts-with(map:keys(.), 'GUID-')]" /> </xsl:map> </xsl:variable> <xsl:variable as="map(xs:string,xs:string)" name="DITA2GUIDmap"> <xsl:map> <xsl:sequence select="$traversalMap ! .[not(starts-with(map:keys(.), 'GUID-'))]" /> </xsl:map> </xsl:variable> (I thought it would be easier to split a sequence of ~map entries into two maps than it would be to traverse the tree twice.) And it works, but it wouldn't work if I was starting with a merged map, rather than a sequence of ~map entries/singleton maps. Is there a way to do this with a merged map, that is, filter a map with multiple entries by testing characteristics of the keys without having to reconsitute each entry? $traverseMap[starts-with(map:key(.),'GUID-')] doesn't work; the context is the WHOLE map, not a map entry. And there doesn't seem to be a way to treat a map as a sequence of map entries. Is there one? Am I missing something? Thanks! -- Graydon Saunders | graydonish@xxxxxxxxx ^fs oferiode, pisses swa mfg. -- Deor ("That passed, so may this.")
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|