[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Processing types of type QName
This is of course much simpler when you have schema support in XSLT 2.0, you can then manipulate the value as an instance of type xs:QName. There are still some pitfalls, however, in making sure that the namespace prefix is always properly declared. In 1.0 there are no functions for parsing the lexical QName value, but it's easy enough to extract the prefix using substring-before. You can translate it to a namespace URI using the namespace axis: <xsl:if test="contains(., ':')"> <xsl:value-of select="namespace::*[name()=substring-before(current(), '.')]"/> </xsl:if> Michael Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Dan Vint > Sent: 19 August 2003 15:11 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Processing types of type QName > > > > > We are considering the use of QName types for our enumerated > values (code > lists). We want to be able to determine the standard values > from those > added by members, so we want member values to be prefixed. > > In theory this seems to work nice, but in XSLT it doesn't > seem to allow for > the normal processing that I would expect. I would really > expect to be able > to use name(), local-name(), etc against the text() node > value but that > doesn't seem to work. Is this something that I have to wait > for v2 of XSLT? > > Our code values are in the element content, so an element is of an > enumerated type. If I use a template that matches this > element, a simple > <xsl:value-of select='.'/> gets me the code value acord:A, > <xsl:value-of > select="name(.)"/> gets me the element name of the template match > statement. <xsl:value-of select="name(text())"/> gets a value > of #text in > Stylus studio. > > I can use the starts-with() function to detect a standard prefix, and > contains() to detect a prefix of given value or at least the > use of the > ':', but I would really like a more flexible approach and I > need to be able > to translate the prefix back into the namespace URI as well. > > Any ideas? > > ..dan > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|