xml - How to get current country-code/locale in XSL? -


I am using XSL transforms on XML. Depend on some part of the change. Is there a way to find the current location from XSL?

For example, a user of a floating point number can vary between visible serialization locale ("1.0" in German for "1.0"), and I would like to address such distinction Should be kept in In XSLT 1.0, but there are ways to work with them, but you must pass it as a parameter for your XSLT processor or depend on the extension. Some processors will give you access to local information, but there is no standard way to do this, and we have to see if it is possible whether it is possible. However, there are some date, time and number formatting functions (limited locally) in XSLT 2.0, and will be managed by the processor, not by you (which is why these functions are :)

some XSLT 1.0 To partially use as a good thing (TM) regardless of the XSLT version in the environment, and I set some basic templates for the type of data you are working on. Literacy, and I have local parameters (as mentioned earlier). For numbers, see for example.

For other local things, I'll create another XML file, and let the parameters work as a picker for your later information. Can look like XML;

  & lt; Local & gt; & Lt; Config id = "de" & gt; & Lt; Currency signage = "& amp; # 8352;" Format-number = "###. ###, ##" / & gt; & Lt; Text id = "welcome" & gt; Wilkamen! & Lt; / Text & gt; & Lt; / Config & gt; & Lt; Config id = "en" & gt; & Lt; Currency notation = "& amp; # 163;" Format-number = "########### & Lt; Text id = "welcome" & gt; welcome! & Lt; / Text & gt; & Lt; / Config & gt; & Lt; Config id = "no" & gt; & Lt; Currency notation = "NOK" format-number = "###. ###, ##" /> & Lt; Text id = "welcome" & gt; Velkommen! & Lt; / Text & gt; & Lt; / Config & gt; & Lt; / Local people & gt;  

From this, open it;

  & lt; Xsl: variable name = "locale" select = "document ('locale.xml') / local / config [@ id = $ parameter.for.locale]" />  

And you can use it for welcome text;

  & lt; Xsl: select value = "$ locale / text [@id = 'welcome']" /> Number for formatting and this is a bit more complex, but it is right that it is the right path and I will expand, but basically you should make some keys on the local XML file, and use a key lookup for the values Please. Let me tell you some of the templates that work with it, and use; numbers and such (tell me what you want to support).  
  & lt; Xsl: call-template name = "my-template" & gt; & Lt; Xsl: with-ultimate name = "this" select = "'some_number'" /> & Lt; / XSL: Call-templates & gt;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -